-
Notifications
You must be signed in to change notification settings - Fork 31
/
boolean.test.js
48 lines (40 loc) · 1.53 KB
/
boolean.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import expect from 'expect.js';
import {validate, bool} from '../src/validate';
describe('Functions Boolean', () => {
describe('#isTrue(value)', () => {
it('should be true when value is true', () => {
let result = validate(bool.isTrue);
expect(result(true)).to.be.ok();
});
it('should be false when value is false', () => {
let result = validate(bool.isTrue);
expect(result(false)).to.not.be.ok();
});
it('should be false when value is null', () => {
let result = validate(bool.isTrue);
expect(result(null)).to.not.be.ok();
});
it('should be false when value is undefined', () => {
let result = validate(bool.isTrue);
expect(result(undefined)).to.not.be.ok();
});
});
describe('#isFalse(value)', () => {
it('should be false when value is true', () => {
let result = validate(bool.isFalse);
expect(result(true)).to.not.be.ok();
});
it('should be true when value is false', () => {
let result = validate(bool.isFalse);
expect(result(false)).to.be.ok();
});
it('should be false when value is null', () => {
let result = validate(bool.isFalse);
expect(result(null)).to.not.be.ok();
});
it('should be false when value is undefined', () => {
let result = validate(bool.isFalse);
expect(result(undefined)).to.not.be.ok();
});
});
});