jasmine-core 2.9.0 → 2.99.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jasmine-core/jasmine-html.js +24 -1
- data/lib/jasmine-core/jasmine.css +1 -0
- data/lib/jasmine-core/jasmine.js +50 -6
- data/lib/jasmine-core/version.rb +1 -1
- metadata +3 -84
- data/lib/jasmine-core/spec/console/ConsoleReporterSpec.js +0 -270
- data/lib/jasmine-core/spec/core/CallTrackerSpec.js +0 -130
- data/lib/jasmine-core/spec/core/ClearStackSpec.js +0 -137
- data/lib/jasmine-core/spec/core/ClockSpec.js +0 -754
- data/lib/jasmine-core/spec/core/DelayedFunctionSchedulerSpec.js +0 -270
- data/lib/jasmine-core/spec/core/EnvSpec.js +0 -200
- data/lib/jasmine-core/spec/core/ExceptionFormatterSpec.js +0 -63
- data/lib/jasmine-core/spec/core/ExceptionsSpec.js +0 -68
- data/lib/jasmine-core/spec/core/ExpectationResultSpec.js +0 -61
- data/lib/jasmine-core/spec/core/ExpectationSpec.js +0 -434
- data/lib/jasmine-core/spec/core/GlobalErrorsSpec.js +0 -110
- data/lib/jasmine-core/spec/core/JsApiReporterSpec.js +0 -259
- data/lib/jasmine-core/spec/core/MockDateSpec.js +0 -200
- data/lib/jasmine-core/spec/core/PrettyPrintSpec.js +0 -337
- data/lib/jasmine-core/spec/core/QueueRunnerSpec.js +0 -620
- data/lib/jasmine-core/spec/core/ReportDispatcherSpec.js +0 -79
- data/lib/jasmine-core/spec/core/SpecSpec.js +0 -441
- data/lib/jasmine-core/spec/core/SpyRegistrySpec.js +0 -356
- data/lib/jasmine-core/spec/core/SpySpec.js +0 -127
- data/lib/jasmine-core/spec/core/SpyStrategySpec.js +0 -159
- data/lib/jasmine-core/spec/core/SuiteSpec.js +0 -155
- data/lib/jasmine-core/spec/core/TimerSpec.js +0 -31
- data/lib/jasmine-core/spec/core/TreeProcessorSpec.js +0 -756
- data/lib/jasmine-core/spec/core/UserContextSpec.js +0 -54
- data/lib/jasmine-core/spec/core/UtilSpec.js +0 -99
- data/lib/jasmine-core/spec/core/asymmetric_equality/AnySpec.js +0 -84
- data/lib/jasmine-core/spec/core/asymmetric_equality/AnythingSpec.js +0 -76
- data/lib/jasmine-core/spec/core/asymmetric_equality/ArrayContainingSpec.js +0 -52
- data/lib/jasmine-core/spec/core/asymmetric_equality/ArrayWithExactContentsSpec.js +0 -47
- data/lib/jasmine-core/spec/core/asymmetric_equality/ObjectContainingSpec.js +0 -102
- data/lib/jasmine-core/spec/core/asymmetric_equality/StringMatchingSpec.js +0 -27
- data/lib/jasmine-core/spec/core/formatErrorMsgSpec.js +0 -13
- data/lib/jasmine-core/spec/core/integration/CustomMatchersSpec.js +0 -199
- data/lib/jasmine-core/spec/core/integration/EnvSpec.js +0 -2007
- data/lib/jasmine-core/spec/core/integration/SpecRunningSpec.js +0 -950
- data/lib/jasmine-core/spec/core/matchers/DiffBuilderSpec.js +0 -47
- data/lib/jasmine-core/spec/core/matchers/NullDiffBuilderSpec.js +0 -13
- data/lib/jasmine-core/spec/core/matchers/ObjectPathSpec.js +0 -43
- data/lib/jasmine-core/spec/core/matchers/matchersUtilSpec.js +0 -658
- data/lib/jasmine-core/spec/core/matchers/nothingSpec.js +0 -8
- data/lib/jasmine-core/spec/core/matchers/toBeCloseToSpec.js +0 -93
- data/lib/jasmine-core/spec/core/matchers/toBeDefinedSpec.js +0 -18
- data/lib/jasmine-core/spec/core/matchers/toBeFalsySpec.js +0 -38
- data/lib/jasmine-core/spec/core/matchers/toBeGreaterThanOrEqualSpec.js +0 -29
- data/lib/jasmine-core/spec/core/matchers/toBeGreaterThanSpec.js +0 -20
- data/lib/jasmine-core/spec/core/matchers/toBeLessThanOrEqualSpec.js +0 -29
- data/lib/jasmine-core/spec/core/matchers/toBeLessThanSpec.js +0 -20
- data/lib/jasmine-core/spec/core/matchers/toBeNaNSpec.js +0 -37
- data/lib/jasmine-core/spec/core/matchers/toBeNegativeInfinitySpec.js +0 -31
- data/lib/jasmine-core/spec/core/matchers/toBeNullSpec.js +0 -17
- data/lib/jasmine-core/spec/core/matchers/toBePositiveInfinitySpec.js +0 -31
- data/lib/jasmine-core/spec/core/matchers/toBeSpec.js +0 -17
- data/lib/jasmine-core/spec/core/matchers/toBeTruthySpec.js +0 -38
- data/lib/jasmine-core/spec/core/matchers/toBeUndefinedSpec.js +0 -18
- data/lib/jasmine-core/spec/core/matchers/toContainSpec.js +0 -26
- data/lib/jasmine-core/spec/core/matchers/toEqualSpec.js +0 -804
- data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledBeforeSpec.js +0 -99
- data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledSpec.js +0 -47
- data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledTimesSpec.js +0 -86
- data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledWithSpec.js +0 -67
- data/lib/jasmine-core/spec/core/matchers/toMatchSpec.js +0 -43
- data/lib/jasmine-core/spec/core/matchers/toThrowErrorSpec.js +0 -315
- data/lib/jasmine-core/spec/core/matchers/toThrowSpec.js +0 -100
- data/lib/jasmine-core/spec/helpers/BrowserFlags.js +0 -27
- data/lib/jasmine-core/spec/helpers/asyncAwait.js +0 -27
- data/lib/jasmine-core/spec/helpers/checkForMap.js +0 -37
- data/lib/jasmine-core/spec/helpers/checkForSet.js +0 -41
- data/lib/jasmine-core/spec/helpers/checkForSymbol.js +0 -28
- data/lib/jasmine-core/spec/helpers/checkForTypedArrays.js +0 -20
- data/lib/jasmine-core/spec/helpers/defineJasmineUnderTest.js +0 -7
- data/lib/jasmine-core/spec/helpers/nodeDefineJasmineUnderTest.js +0 -33
- data/lib/jasmine-core/spec/html/HtmlReporterSpec.js +0 -982
- data/lib/jasmine-core/spec/html/HtmlSpecFilterSpec.js +0 -18
- data/lib/jasmine-core/spec/html/MatchersHtmlSpec.js +0 -37
- data/lib/jasmine-core/spec/html/PrettyPrintHtmlSpec.js +0 -15
- data/lib/jasmine-core/spec/html/QueryStringSpec.js +0 -72
- data/lib/jasmine-core/spec/html/ResultsNodeSpec.js +0 -62
- data/lib/jasmine-core/spec/html/SpyRegistryHtmlSpec.js +0 -34
- data/lib/jasmine-core/spec/npmPackage/npmPackageSpec.js +0 -101
- data/lib/jasmine-core/spec/performance/large_object_test.js +0 -36
- data/lib/jasmine-core/spec/performance/performance_test.js +0 -10
@@ -1,93 +0,0 @@
|
|
1
|
-
describe("toBeCloseTo", function() {
|
2
|
-
it("passes when within two decimal places by default", function() {
|
3
|
-
var matcher = jasmineUnderTest.matchers.toBeCloseTo(),
|
4
|
-
result;
|
5
|
-
|
6
|
-
result = matcher.compare(0, 0);
|
7
|
-
expect(result.pass).toBe(true);
|
8
|
-
|
9
|
-
result = matcher.compare(0, 0.001);
|
10
|
-
expect(result.pass).toBe(true);
|
11
|
-
|
12
|
-
result = matcher.compare(0, 0.005);
|
13
|
-
expect(result.pass).toBe(true);
|
14
|
-
});
|
15
|
-
|
16
|
-
it("fails when not within two decimal places by default", function() {
|
17
|
-
var matcher = jasmineUnderTest.matchers.toBeCloseTo(),
|
18
|
-
result;
|
19
|
-
|
20
|
-
result = matcher.compare(0, 0.01);
|
21
|
-
expect(result.pass).toBe(false);
|
22
|
-
|
23
|
-
result = matcher.compare(0, 0.05);
|
24
|
-
expect(result.pass).toBe(false);
|
25
|
-
});
|
26
|
-
|
27
|
-
it("accepts an optional precision argument", function() {
|
28
|
-
var matcher = jasmineUnderTest.matchers.toBeCloseTo(),
|
29
|
-
result;
|
30
|
-
|
31
|
-
result = matcher.compare(0, 0.1, 0);
|
32
|
-
expect(result.pass).toBe(true);
|
33
|
-
|
34
|
-
result = matcher.compare(0, 0.5, 0);
|
35
|
-
expect(result.pass).toBe(true);
|
36
|
-
|
37
|
-
result = matcher.compare(0, 0.0001, 3);
|
38
|
-
expect(result.pass).toBe(true);
|
39
|
-
|
40
|
-
result = matcher.compare(0, 0.0005, 3);
|
41
|
-
expect(result.pass).toBe(true);
|
42
|
-
|
43
|
-
result = matcher.compare(0, 0.00001, 4);
|
44
|
-
expect(result.pass).toBe(true);
|
45
|
-
|
46
|
-
result = matcher.compare(0, 0.00005, 4);
|
47
|
-
expect(result.pass).toBe(true);
|
48
|
-
});
|
49
|
-
|
50
|
-
it("fails when one of the arguments is null", function() {
|
51
|
-
var matcher = jasmineUnderTest.matchers.toBeCloseTo();
|
52
|
-
|
53
|
-
expect(function() {
|
54
|
-
matcher.compare(null, null);
|
55
|
-
}).toThrowError('Cannot use toBeCloseTo with null. Arguments evaluated to: expect(null).toBeCloseTo(null).');
|
56
|
-
|
57
|
-
expect(function() {
|
58
|
-
matcher.compare(0, null);
|
59
|
-
}).toThrowError('Cannot use toBeCloseTo with null. Arguments evaluated to: expect(0).toBeCloseTo(null).');
|
60
|
-
|
61
|
-
expect(function() {
|
62
|
-
matcher.compare(null, 0);
|
63
|
-
}).toThrowError('Cannot use toBeCloseTo with null. Arguments evaluated to: expect(null).toBeCloseTo(0).');
|
64
|
-
});
|
65
|
-
|
66
|
-
it("rounds expected values", function() {
|
67
|
-
var matcher = jasmineUnderTest.matchers.toBeCloseTo(),
|
68
|
-
result;
|
69
|
-
|
70
|
-
result = matcher.compare(1.23, 1.229);
|
71
|
-
expect(result.pass).toBe(true);
|
72
|
-
|
73
|
-
result = matcher.compare(1.23, 1.226);
|
74
|
-
expect(result.pass).toBe(true);
|
75
|
-
|
76
|
-
result = matcher.compare(1.23, 1.225);
|
77
|
-
expect(result.pass).toBe(true);
|
78
|
-
|
79
|
-
result = matcher.compare(1.23, 1.235);
|
80
|
-
expect(result.pass).toBe(true);
|
81
|
-
|
82
|
-
// 1.2249999 will be rounded to 1.225
|
83
|
-
result = matcher.compare(1.23, 1.2249999);
|
84
|
-
expect(result.pass).toBe(true);
|
85
|
-
|
86
|
-
// 1.2249999 will be rounded to 1.224
|
87
|
-
result = matcher.compare(1.23, 1.2244999);
|
88
|
-
expect(result.pass).toBe(false);
|
89
|
-
|
90
|
-
result = matcher.compare(1.23, 1.234);
|
91
|
-
expect(result.pass).toBe(true);
|
92
|
-
});
|
93
|
-
});
|
@@ -1,18 +0,0 @@
|
|
1
|
-
describe("toBeDefined", function() {
|
2
|
-
it("matches for defined values", function() {
|
3
|
-
var matcher = jasmineUnderTest.matchers.toBeDefined(),
|
4
|
-
result;
|
5
|
-
|
6
|
-
|
7
|
-
result = matcher.compare('foo');
|
8
|
-
expect(result.pass).toBe(true);
|
9
|
-
});
|
10
|
-
|
11
|
-
it("fails when matching undefined values", function() {
|
12
|
-
var matcher = jasmineUnderTest.matchers.toBeDefined(),
|
13
|
-
result;
|
14
|
-
|
15
|
-
result = matcher.compare(void 0);
|
16
|
-
expect(result.pass).toBe(false);
|
17
|
-
})
|
18
|
-
});
|
@@ -1,38 +0,0 @@
|
|
1
|
-
describe("toBeFalsy", function() {
|
2
|
-
it("passes for 'falsy' values", function() {
|
3
|
-
var matcher = jasmineUnderTest.matchers.toBeFalsy(),
|
4
|
-
result;
|
5
|
-
|
6
|
-
result = matcher.compare(false);
|
7
|
-
expect(result.pass).toBe(true);
|
8
|
-
|
9
|
-
result = matcher.compare(0);
|
10
|
-
expect(result.pass).toBe(true);
|
11
|
-
|
12
|
-
result = matcher.compare('');
|
13
|
-
expect(result.pass).toBe(true);
|
14
|
-
|
15
|
-
result = matcher.compare(null);
|
16
|
-
expect(result.pass).toBe(true);
|
17
|
-
|
18
|
-
result = matcher.compare(void 0);
|
19
|
-
expect(result.pass).toBe(true);
|
20
|
-
});
|
21
|
-
|
22
|
-
it("fails for 'truthy' values", function() {
|
23
|
-
var matcher = jasmineUnderTest.matchers.toBeFalsy(),
|
24
|
-
result;
|
25
|
-
|
26
|
-
result = matcher.compare(true);
|
27
|
-
expect(result.pass).toBe(false);
|
28
|
-
|
29
|
-
result = matcher.compare(1);
|
30
|
-
expect(result.pass).toBe(false);
|
31
|
-
|
32
|
-
result = matcher.compare("foo");
|
33
|
-
expect(result.pass).toBe(false);
|
34
|
-
|
35
|
-
result = matcher.compare({});
|
36
|
-
expect(result.pass).toBe(false);
|
37
|
-
});
|
38
|
-
});
|
@@ -1,29 +0,0 @@
|
|
1
|
-
describe("toBeGreaterThanOrEqual", function() {
|
2
|
-
it("passes when actual >= expected", function() {
|
3
|
-
var matcher = jasmineUnderTest.matchers.toBeGreaterThanOrEqual(),
|
4
|
-
result;
|
5
|
-
|
6
|
-
result = matcher.compare(2, 1);
|
7
|
-
expect(result.pass).toBe(true);
|
8
|
-
|
9
|
-
result = matcher.compare(1, 1);
|
10
|
-
expect(result.pass).toBe(true);
|
11
|
-
|
12
|
-
result = matcher.compare(1.0000001, 1);
|
13
|
-
expect(result.pass).toBe(true);
|
14
|
-
|
15
|
-
result = matcher.compare(1.0, 1.0);
|
16
|
-
expect(result.pass).toBe(true);
|
17
|
-
})
|
18
|
-
|
19
|
-
it("fails when actual < expected", function() {
|
20
|
-
var matcher = jasmineUnderTest.matchers.toBeGreaterThanOrEqual(),
|
21
|
-
result;
|
22
|
-
|
23
|
-
result = matcher.compare(1, 2);
|
24
|
-
expect(result.pass).toBe(false);
|
25
|
-
|
26
|
-
result = matcher.compare(1, 1.0000001);
|
27
|
-
expect(result.pass).toBe(false);
|
28
|
-
})
|
29
|
-
});
|
@@ -1,20 +0,0 @@
|
|
1
|
-
describe("toBeGreaterThan", function() {
|
2
|
-
it("passes when actual > expected", function() {
|
3
|
-
var matcher = jasmineUnderTest.matchers.toBeGreaterThan(),
|
4
|
-
result;
|
5
|
-
|
6
|
-
result = matcher.compare(2, 1);
|
7
|
-
expect(result.pass).toBe(true);
|
8
|
-
});
|
9
|
-
|
10
|
-
it("fails when actual <= expected", function() {
|
11
|
-
var matcher = jasmineUnderTest.matchers.toBeGreaterThan(),
|
12
|
-
result;
|
13
|
-
|
14
|
-
result = matcher.compare(1, 1);
|
15
|
-
expect(result.pass).toBe(false);
|
16
|
-
|
17
|
-
result = matcher.compare(1, 2);
|
18
|
-
expect(result.pass).toBe(false);
|
19
|
-
});
|
20
|
-
});
|
@@ -1,29 +0,0 @@
|
|
1
|
-
describe("toBeLessThanOrEqual", function() {
|
2
|
-
it("passes when actual <= expected", function() {
|
3
|
-
var matcher = jasmineUnderTest.matchers.toBeLessThanOrEqual(),
|
4
|
-
result;
|
5
|
-
|
6
|
-
result = matcher.compare(1, 2);
|
7
|
-
expect(result.pass).toBe(true);
|
8
|
-
|
9
|
-
result = matcher.compare(1, 1);
|
10
|
-
expect(result.pass).toBe(true);
|
11
|
-
|
12
|
-
result = matcher.compare(1, 1.0000001);
|
13
|
-
expect(result.pass).toBe(true);
|
14
|
-
|
15
|
-
result = matcher.compare(1.0, 1.0);
|
16
|
-
expect(result.pass).toBe(true);
|
17
|
-
});
|
18
|
-
|
19
|
-
it("fails when actual < expected", function() {
|
20
|
-
var matcher = jasmineUnderTest.matchers.toBeLessThanOrEqual(),
|
21
|
-
result;
|
22
|
-
|
23
|
-
result = matcher.compare(2, 1);
|
24
|
-
expect(result.pass).toBe(false);
|
25
|
-
|
26
|
-
result = matcher.compare(1.0000001, 1);
|
27
|
-
expect(result.pass).toBe(false);
|
28
|
-
});
|
29
|
-
});
|
@@ -1,20 +0,0 @@
|
|
1
|
-
describe("toBeLessThan", function() {
|
2
|
-
it("passes when actual < expected", function() {
|
3
|
-
var matcher = jasmineUnderTest.matchers.toBeLessThan(),
|
4
|
-
result;
|
5
|
-
|
6
|
-
result = matcher.compare(1, 2);
|
7
|
-
expect(result.pass).toBe(true);
|
8
|
-
});
|
9
|
-
|
10
|
-
it("fails when actual <= expected", function() {
|
11
|
-
var matcher = jasmineUnderTest.matchers.toBeLessThan(),
|
12
|
-
result;
|
13
|
-
|
14
|
-
result = matcher.compare(1, 1);
|
15
|
-
expect(result.pass).toBe(false);
|
16
|
-
|
17
|
-
result = matcher.compare(2, 1);
|
18
|
-
expect(result.pass).toBe(false);
|
19
|
-
});
|
20
|
-
});
|
@@ -1,37 +0,0 @@
|
|
1
|
-
describe("toBeNaN", function() {
|
2
|
-
it("passes for NaN with a custom .not fail", function() {
|
3
|
-
var matcher = jasmineUnderTest.matchers.toBeNaN(),
|
4
|
-
result;
|
5
|
-
|
6
|
-
result = matcher.compare(Number.NaN);
|
7
|
-
expect(result.pass).toBe(true);
|
8
|
-
expect(result.message).toEqual("Expected actual not to be NaN.");
|
9
|
-
});
|
10
|
-
|
11
|
-
it("fails for anything not a NaN", function() {
|
12
|
-
var matcher = jasmineUnderTest.matchers.toBeNaN(),
|
13
|
-
result;
|
14
|
-
|
15
|
-
result = matcher.compare(1);
|
16
|
-
expect(result.pass).toBe(false);
|
17
|
-
|
18
|
-
result = matcher.compare(null);
|
19
|
-
expect(result.pass).toBe(false);
|
20
|
-
|
21
|
-
result = matcher.compare(void 0);
|
22
|
-
expect(result.pass).toBe(false);
|
23
|
-
|
24
|
-
result = matcher.compare('');
|
25
|
-
expect(result.pass).toBe(false);
|
26
|
-
|
27
|
-
result = matcher.compare(Number.POSITIVE_INFINITY);
|
28
|
-
expect(result.pass).toBe(false);
|
29
|
-
});
|
30
|
-
|
31
|
-
it("has a custom message on failure", function() {
|
32
|
-
var matcher = jasmineUnderTest.matchers.toBeNaN(),
|
33
|
-
result = matcher.compare(0);
|
34
|
-
|
35
|
-
expect(result.message()).toEqual("Expected 0 to be NaN.");
|
36
|
-
});
|
37
|
-
});
|
@@ -1,31 +0,0 @@
|
|
1
|
-
describe("toBeNegativeInfinity", function() {
|
2
|
-
it("fails for anything that isn't -Infinity", function() {
|
3
|
-
var matcher = jasmineUnderTest.matchers.toBeNegativeInfinity(),
|
4
|
-
result;
|
5
|
-
|
6
|
-
result = matcher.compare(1);
|
7
|
-
expect(result.pass).toBe(false);
|
8
|
-
|
9
|
-
result = matcher.compare(Number.NaN);
|
10
|
-
expect(result.pass).toBe(false);
|
11
|
-
|
12
|
-
result = matcher.compare(null);
|
13
|
-
expect(result.pass).toBe(false);
|
14
|
-
});
|
15
|
-
|
16
|
-
it("has a custom message on failure", function() {
|
17
|
-
var matcher = jasmineUnderTest.matchers.toBeNegativeInfinity(),
|
18
|
-
result = matcher.compare(0);
|
19
|
-
|
20
|
-
expect(result.message()).toEqual("Expected 0 not to be -Infinity.")
|
21
|
-
});
|
22
|
-
|
23
|
-
it("succeeds for -Infinity", function() {
|
24
|
-
var matcher = jasmineUnderTest.matchers.toBeNegativeInfinity(),
|
25
|
-
result = matcher.compare(Number.NEGATIVE_INFINITY);
|
26
|
-
|
27
|
-
expect(result.pass).toBe(true);
|
28
|
-
expect(result.message).toEqual("Expected actual to be -Infinity.")
|
29
|
-
});
|
30
|
-
|
31
|
-
});
|
@@ -1,17 +0,0 @@
|
|
1
|
-
describe("toBeNull", function() {
|
2
|
-
it("passes for null", function() {
|
3
|
-
var matcher = jasmineUnderTest.matchers.toBeNull(),
|
4
|
-
result;
|
5
|
-
|
6
|
-
result = matcher.compare(null);
|
7
|
-
expect(result.pass).toBe(true);
|
8
|
-
});
|
9
|
-
|
10
|
-
it("fails for non-null", function() {
|
11
|
-
var matcher = jasmineUnderTest.matchers.toBeNull(),
|
12
|
-
result;
|
13
|
-
|
14
|
-
result = matcher.compare('foo');
|
15
|
-
expect(result.pass).toBe(false);
|
16
|
-
});
|
17
|
-
});
|
@@ -1,31 +0,0 @@
|
|
1
|
-
describe("toBePositiveInfinity", function() {
|
2
|
-
it("fails for anything that isn't Infinity", function() {
|
3
|
-
var matcher = jasmineUnderTest.matchers.toBePositiveInfinity(),
|
4
|
-
result;
|
5
|
-
|
6
|
-
result = matcher.compare(1);
|
7
|
-
expect(result.pass).toBe(false);
|
8
|
-
|
9
|
-
result = matcher.compare(Number.NaN);
|
10
|
-
expect(result.pass).toBe(false);
|
11
|
-
|
12
|
-
result = matcher.compare(null);
|
13
|
-
expect(result.pass).toBe(false);
|
14
|
-
});
|
15
|
-
|
16
|
-
it("has a custom message on failure", function() {
|
17
|
-
var matcher = jasmineUnderTest.matchers.toBePositiveInfinity(),
|
18
|
-
result = matcher.compare(0);
|
19
|
-
|
20
|
-
expect(result.message()).toEqual("Expected 0 not to be Infinity.")
|
21
|
-
});
|
22
|
-
|
23
|
-
it("succeeds for Infinity", function() {
|
24
|
-
var matcher = jasmineUnderTest.matchers.toBePositiveInfinity(),
|
25
|
-
result = matcher.compare(Number.POSITIVE_INFINITY);
|
26
|
-
|
27
|
-
expect(result.pass).toBe(true);
|
28
|
-
expect(result.message).toEqual("Expected actual to be Infinity.")
|
29
|
-
});
|
30
|
-
|
31
|
-
});
|
@@ -1,17 +0,0 @@
|
|
1
|
-
describe("toBe", function() {
|
2
|
-
it("passes when actual === expected", function() {
|
3
|
-
var matcher = jasmineUnderTest.matchers.toBe(),
|
4
|
-
result;
|
5
|
-
|
6
|
-
result = matcher.compare(1, 1);
|
7
|
-
expect(result.pass).toBe(true);
|
8
|
-
});
|
9
|
-
|
10
|
-
it("fails when actual !== expected", function() {
|
11
|
-
var matcher = jasmineUnderTest.matchers.toBe(),
|
12
|
-
result;
|
13
|
-
|
14
|
-
result = matcher.compare(1, 2);
|
15
|
-
expect(result.pass).toBe(false);
|
16
|
-
});
|
17
|
-
});
|
@@ -1,38 +0,0 @@
|
|
1
|
-
describe("toBeTruthy", function() {
|
2
|
-
it("passes for 'truthy' values", function() {
|
3
|
-
var matcher = jasmineUnderTest.matchers.toBeTruthy(),
|
4
|
-
result;
|
5
|
-
|
6
|
-
result = matcher.compare(true);
|
7
|
-
expect(result.pass).toBe(true);
|
8
|
-
|
9
|
-
result = matcher.compare(1);
|
10
|
-
expect(result.pass).toBe(true);
|
11
|
-
|
12
|
-
result = matcher.compare("foo");
|
13
|
-
expect(result.pass).toBe(true);
|
14
|
-
|
15
|
-
result = matcher.compare({});
|
16
|
-
expect(result.pass).toBe(true);
|
17
|
-
});
|
18
|
-
|
19
|
-
it("fails for 'falsy' values", function() {
|
20
|
-
var matcher = jasmineUnderTest.matchers.toBeTruthy(),
|
21
|
-
result;
|
22
|
-
|
23
|
-
result = matcher.compare(false);
|
24
|
-
expect(result.pass).toBe(false);
|
25
|
-
|
26
|
-
result = matcher.compare(0);
|
27
|
-
expect(result.pass).toBe(false);
|
28
|
-
|
29
|
-
result = matcher.compare('');
|
30
|
-
expect(result.pass).toBe(false);
|
31
|
-
|
32
|
-
result = matcher.compare(null);
|
33
|
-
expect(result.pass).toBe(false);
|
34
|
-
|
35
|
-
result = matcher.compare(void 0);
|
36
|
-
expect(result.pass).toBe(false);
|
37
|
-
});
|
38
|
-
});
|
@@ -1,18 +0,0 @@
|
|
1
|
-
describe("toBeUndefined", function() {
|
2
|
-
it("passes for undefined values", function() {
|
3
|
-
var matcher = jasmineUnderTest.matchers.toBeUndefined(),
|
4
|
-
result;
|
5
|
-
|
6
|
-
result = matcher.compare(void 0);
|
7
|
-
expect(result.pass).toBe(true);
|
8
|
-
|
9
|
-
});
|
10
|
-
|
11
|
-
it("fails when matching defined values", function() {
|
12
|
-
var matcher = jasmineUnderTest.matchers.toBeUndefined(),
|
13
|
-
result;
|
14
|
-
|
15
|
-
result = matcher.compare('foo');
|
16
|
-
expect(result.pass).toBe(false);
|
17
|
-
})
|
18
|
-
});
|
@@ -1,26 +0,0 @@
|
|
1
|
-
describe("toContain", function() {
|
2
|
-
it("delegates to jasmineUnderTest.matchersUtil.contains", function() {
|
3
|
-
var util = {
|
4
|
-
contains: jasmine.createSpy('delegated-contains').and.returnValue(true)
|
5
|
-
},
|
6
|
-
matcher = jasmineUnderTest.matchers.toContain(util),
|
7
|
-
result;
|
8
|
-
|
9
|
-
result = matcher.compare("ABC", "B");
|
10
|
-
expect(util.contains).toHaveBeenCalledWith("ABC", "B", []);
|
11
|
-
expect(result.pass).toBe(true);
|
12
|
-
});
|
13
|
-
|
14
|
-
it("delegates to jasmineUnderTest.matchersUtil.contains, passing in equality testers if present", function() {
|
15
|
-
var util = {
|
16
|
-
contains: jasmine.createSpy('delegated-contains').and.returnValue(true)
|
17
|
-
},
|
18
|
-
customEqualityTesters = ['a', 'b'],
|
19
|
-
matcher = jasmineUnderTest.matchers.toContain(util, customEqualityTesters),
|
20
|
-
result;
|
21
|
-
|
22
|
-
result = matcher.compare("ABC", "B");
|
23
|
-
expect(util.contains).toHaveBeenCalledWith("ABC", "B", ['a', 'b']);
|
24
|
-
expect(result.pass).toBe(true);
|
25
|
-
});
|
26
|
-
});
|