-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjmoney.tests.html
More file actions
107 lines (102 loc) · 3.71 KB
/
Copy pathjmoney.tests.html
File metadata and controls
107 lines (102 loc) · 3.71 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<!DOCTYPE html>
<html>
<head>
<title>jUnit Tests</title>
<script type="text/javascript" src="jMoney/jmoney.min.js"></script>
<script>
/* toBeTrue */
when('Using jn.Predicates.toBeTrue', function() {
spec('should be true when passed true').expect(function() {
var p = new jn.Predicates(null, true, null, false);
return p.toBeTrue() === true;
}).toBeTrue();
spec('should fail when passed false').expect(function() {
var p = new jn.Predicates(null, false, null, false);
return p.toBeTrue() === false;
}).toBeTrue();
});
/* not().toBeTrue */
when('Using jn.Predicates.not().toBeTrue', function() {
spec('should fail when passed false').expect(function() {
var p = new jn.Predicates(null, true, null, true);
return p.toBeTrue() === true;
}).toBeTrue();
spec('should pass when pass false').expect(function() {
var p = new jn.Predicates(null, false, null, true);
return p.toBeTrue() === false;
}).toBeTrue();
});
/* toBe */
when('Using jn.toBe', function() {
spec('should be success when passed matching string values').expect(function() {
var p = new jn.Predicates(null, 'my string', null, false);
return p.toBe('my string');
}).toBeTrue();
spec('should be success when passed matching number values').expect(function() {
var p = new jn.Predicates(null, 7, null, false);
return p.toBe(7);
}).toBeTrue();
spec('should fail when passed mis-matching string values').expect(function() {
var p = new jn.Predicates(null, 'foo', null, false);
return p.toBe('bar');
}).not().toBeTrue();
spec('should fail when passed mis-matching number values').expect(function() {
var p = new jn.Predicates(null, 25, null, false);
return p.toBe(7);
}).not().toBeTrue();
});
/*toBeNull*/
when('Using jn.toBeNull', function() {
spec('should be success when passed a null variable').expect(function() {
var p = new jn.Predicates(null, null, null, false);
return p.toBeNull();
}).toBeTrue();
spec('should fail when passed a string').expect(function() {
var p = new jn.Predicates(null, 'a string', null, false);
return p.toBeNull();
}).not().toBeTrue();
spec('should fail when passed a number').expect(function() {
var p = new jn.Predicates(null, 8, null, false);
return p.toBeNull();
}).not().toBeTrue();
spec('should fail when passed a object').expect(function() {
var p = new jn.Predicates(null, {}, null, false);
return p.toBeNull();
}).not().toBeTrue();
});
/*toBeUndefined*/
when('Using jn.toBeUndefined', function() {
spec('should be success when passed a undefined variable').expect(function() {
var u;
var p = new jn.Predicates(null, u, null, false);
return p.toBeUndefined();
}).toBeTrue();
spec('should fail when passed a string').expect(function() {
var p = new jn.Predicates(null, 'a string', null, false);
return p.toBeUndefined();
}).not().toBeTrue();
spec('should fail when passed a number').expect(function() {
var p = new jn.Predicates(null, 8, null, false);
return p.toBeUndefined();
}).not().toBeTrue();
spec('should fail when passed a object').expect(function() {
var p = new jn.Predicates(null, {}, null, false);
return p.toBeUndefined();
}).not().toBeTrue();
});
/*toBeNumeric*/
when('Using jn.Predicates.toBeNumeric', function() {
spec('should be true when passed a number').expect(function() {
var p = new jn.Predicates(null, 7, null, false);
return p.toBeNumeric();
}).toBeTrue();
spec('should fail when passed a string').expect(function() {
var p = new jn.Predicates(null, '7', null, false);
return p.toBeNumeric();
}).not().toBeTrue();
});
</script>
</head>
<body>
</body>
</html>