-
Notifications
You must be signed in to change notification settings - Fork 3
/
bool.js
59 lines (54 loc) · 2 KB
/
bool.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
49
50
51
52
53
54
55
56
57
58
59
var atoum = require('../..')(module),
Generator = require('../../lib/asserter/generator'),
variable = require('../../lib/asserters/variable'),
testedClass = require('../../lib/asserters/bool'),
unit = module.exports = {
testClass: function() {
var object, generator;
this
.if(generator = new Generator())
.then()
.object(object = new testedClass(generator)).isInstanceOf(variable)
.object(object.generator).isEqualTo(generator)
;
},
testSetWith: function() {
var object, value;
this
.if(object = new testedClass(new Generator()))
.then()
.error(function() {
object.setWith(value)
})
.hasName('Failure')
.hasMessage('undefined is not a boolean')
.if(value = {})
.then()
.error(function() {
object.setWith(value)
})
.hasName('Failure')
.hasMessage('[object Object] is not a boolean')
.if(value = true)
.then()
.object(object.setWith(value)).isIdenticalTo(object)
.bool(object.value).isEqualTo(value)
;
},
testIsTrue: function() {
var object;
this
.if(object = new testedClass(new Generator()))
.and(object.setWith(true))
.then()
.object(object.isTrue()).isIdenticalTo(object)
.if(object.setWith(false))
.then()
.error(function() {
object.isTrue();
})
.hasName('Failure')
.hasMessage('false is not identical to true')
;
}
};