jasmine-core 3.0.0 → 3.1.0
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/boot/node_boot.js +1 -1
- data/lib/jasmine-core/jasmine-html.js +0 -35
- data/lib/jasmine-core/jasmine.css +0 -6
- data/lib/jasmine-core/jasmine.js +246 -36
- data/lib/jasmine-core/node_boot.js +1 -1
- data/lib/jasmine-core/version.rb +1 -1
- metadata +3 -88
- 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 -710
- data/lib/jasmine-core/spec/core/DelayedFunctionSchedulerSpec.js +0 -286
- data/lib/jasmine-core/spec/core/EnvSpec.js +0 -200
- data/lib/jasmine-core/spec/core/ExceptionFormatterSpec.js +0 -120
- data/lib/jasmine-core/spec/core/ExceptionsSpec.js +0 -46
- 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 -332
- data/lib/jasmine-core/spec/core/QueueRunnerSpec.js +0 -670
- data/lib/jasmine-core/spec/core/ReportDispatcherSpec.js +0 -140
- data/lib/jasmine-core/spec/core/SpecSpec.js +0 -407
- data/lib/jasmine-core/spec/core/SpyRegistrySpec.js +0 -364
- data/lib/jasmine-core/spec/core/SpySpec.js +0 -177
- data/lib/jasmine-core/spec/core/SpyStrategySpec.js +0 -202
- data/lib/jasmine-core/spec/core/StackTraceSpec.js +0 -166
- data/lib/jasmine-core/spec/core/SuiteSpec.js +0 -123
- data/lib/jasmine-core/spec/core/TimerSpec.js +0 -31
- data/lib/jasmine-core/spec/core/TreeProcessorSpec.js +0 -794
- data/lib/jasmine-core/spec/core/UserContextSpec.js +0 -54
- data/lib/jasmine-core/spec/core/UtilSpec.js +0 -105
- data/lib/jasmine-core/spec/core/asymmetric_equality/AnySpec.js +0 -91
- 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 -99
- 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 -200
- data/lib/jasmine-core/spec/core/integration/CustomSpyStrategiesSpec.js +0 -138
- data/lib/jasmine-core/spec/core/integration/EnvSpec.js +0 -2344
- data/lib/jasmine-core/spec/core/integration/SpecRunningSpec.js +0 -976
- 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 -645
- 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 -785
- 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/toThrowMatchingSpec.js +0 -73
- data/lib/jasmine-core/spec/core/matchers/toThrowSpec.js +0 -100
- data/lib/jasmine-core/spec/helpers/BrowserFlags.js +0 -15
- 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 -6
- data/lib/jasmine-core/spec/helpers/integrationMatchers.js +0 -43
- data/lib/jasmine-core/spec/helpers/nodeDefineJasmineUnderTest.js +0 -30
- data/lib/jasmine-core/spec/html/HtmlReporterSpec.js +0 -1261
- 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 -27
- 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 -39
- data/lib/jasmine-core/spec/html/matchers/toHaveClassSpec.js +0 -48
- 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,286 +0,0 @@
|
|
1
|
-
describe("DelayedFunctionScheduler", function() {
|
2
|
-
it("schedules a function for later execution", function() {
|
3
|
-
var scheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
4
|
-
fn = jasmine.createSpy('fn');
|
5
|
-
|
6
|
-
scheduler.scheduleFunction(fn, 0);
|
7
|
-
|
8
|
-
expect(fn).not.toHaveBeenCalled();
|
9
|
-
|
10
|
-
scheduler.tick(0);
|
11
|
-
|
12
|
-
expect(fn).toHaveBeenCalled();
|
13
|
-
});
|
14
|
-
|
15
|
-
it("schedules a string for later execution", function() {
|
16
|
-
var scheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
17
|
-
strfn = "horrible = true;";
|
18
|
-
|
19
|
-
scheduler.scheduleFunction(strfn, 0);
|
20
|
-
|
21
|
-
scheduler.tick(0);
|
22
|
-
|
23
|
-
expect(horrible).toEqual(true);
|
24
|
-
});
|
25
|
-
|
26
|
-
it("#tick defaults to 0", function() {
|
27
|
-
var scheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
28
|
-
fn = jasmine.createSpy('fn');
|
29
|
-
|
30
|
-
scheduler.scheduleFunction(fn, 0);
|
31
|
-
|
32
|
-
expect(fn).not.toHaveBeenCalled();
|
33
|
-
|
34
|
-
scheduler.tick();
|
35
|
-
|
36
|
-
expect(fn).toHaveBeenCalled();
|
37
|
-
});
|
38
|
-
|
39
|
-
it("defaults delay to 0", function() {
|
40
|
-
var scheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
41
|
-
fn = jasmine.createSpy('fn');
|
42
|
-
|
43
|
-
scheduler.scheduleFunction(fn);
|
44
|
-
|
45
|
-
expect(fn).not.toHaveBeenCalled();
|
46
|
-
|
47
|
-
scheduler.tick(0);
|
48
|
-
|
49
|
-
expect(fn).toHaveBeenCalled();
|
50
|
-
});
|
51
|
-
|
52
|
-
it("optionally passes params to scheduled functions", function() {
|
53
|
-
var scheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
54
|
-
fn = jasmine.createSpy('fn');
|
55
|
-
|
56
|
-
scheduler.scheduleFunction(fn, 0, ['foo', 'bar']);
|
57
|
-
|
58
|
-
expect(fn).not.toHaveBeenCalled();
|
59
|
-
|
60
|
-
scheduler.tick(0);
|
61
|
-
|
62
|
-
expect(fn).toHaveBeenCalledWith('foo', 'bar');
|
63
|
-
});
|
64
|
-
|
65
|
-
it("scheduled fns can optionally reoccur", function() {
|
66
|
-
var scheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
67
|
-
fn = jasmine.createSpy('fn');
|
68
|
-
|
69
|
-
scheduler.scheduleFunction(fn, 20, [], true);
|
70
|
-
|
71
|
-
expect(fn).not.toHaveBeenCalled();
|
72
|
-
|
73
|
-
scheduler.tick(20);
|
74
|
-
|
75
|
-
expect(fn.calls.count()).toBe(1);
|
76
|
-
|
77
|
-
scheduler.tick(40);
|
78
|
-
|
79
|
-
expect(fn.calls.count()).toBe(3);
|
80
|
-
|
81
|
-
scheduler.tick(21);
|
82
|
-
|
83
|
-
expect(fn.calls.count()).toBe(4);
|
84
|
-
|
85
|
-
});
|
86
|
-
|
87
|
-
it("increments scheduled fns ids unless one is passed", function() {
|
88
|
-
var scheduler = new jasmineUnderTest.DelayedFunctionScheduler();
|
89
|
-
|
90
|
-
expect(scheduler.scheduleFunction(function() {
|
91
|
-
}, 0)).toBe(1);
|
92
|
-
expect(scheduler.scheduleFunction(function() {
|
93
|
-
}, 0)).toBe(2);
|
94
|
-
expect(scheduler.scheduleFunction(function() {
|
95
|
-
}, 0, [], false, 123)).toBe(123);
|
96
|
-
expect(scheduler.scheduleFunction(function() {
|
97
|
-
}, 0)).toBe(3);
|
98
|
-
});
|
99
|
-
|
100
|
-
it("#removeFunctionWithId removes a previously scheduled function with a given id", function() {
|
101
|
-
var scheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
102
|
-
fn = jasmine.createSpy('fn'),
|
103
|
-
timeoutKey;
|
104
|
-
|
105
|
-
timeoutKey = scheduler.scheduleFunction(fn, 0);
|
106
|
-
|
107
|
-
expect(fn).not.toHaveBeenCalled();
|
108
|
-
|
109
|
-
scheduler.removeFunctionWithId(timeoutKey);
|
110
|
-
|
111
|
-
scheduler.tick(0);
|
112
|
-
|
113
|
-
expect(fn).not.toHaveBeenCalled();
|
114
|
-
});
|
115
|
-
|
116
|
-
it("executes recurring functions interleaved with regular functions in the correct order", function() {
|
117
|
-
var scheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
118
|
-
fn = jasmine.createSpy('fn'),
|
119
|
-
recurringCallCount = 0,
|
120
|
-
recurring = jasmine.createSpy('recurring').and.callFake(function() {
|
121
|
-
recurringCallCount++;
|
122
|
-
if (recurringCallCount < 5) {
|
123
|
-
expect(fn).not.toHaveBeenCalled();
|
124
|
-
}
|
125
|
-
});
|
126
|
-
|
127
|
-
scheduler.scheduleFunction(recurring, 10, [], true);
|
128
|
-
scheduler.scheduleFunction(fn, 50);
|
129
|
-
|
130
|
-
scheduler.tick(60);
|
131
|
-
|
132
|
-
expect(recurring).toHaveBeenCalled();
|
133
|
-
expect(recurring.calls.count()).toBe(6);
|
134
|
-
expect(fn).toHaveBeenCalled();
|
135
|
-
});
|
136
|
-
|
137
|
-
it("schedules a function for later execution during a tick", function () {
|
138
|
-
var scheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
139
|
-
fn = jasmine.createSpy('fn'),
|
140
|
-
fnDelay = 10;
|
141
|
-
|
142
|
-
scheduler.scheduleFunction(function () {
|
143
|
-
scheduler.scheduleFunction(fn, fnDelay);
|
144
|
-
}, 0);
|
145
|
-
|
146
|
-
expect(fn).not.toHaveBeenCalled();
|
147
|
-
|
148
|
-
scheduler.tick(fnDelay);
|
149
|
-
|
150
|
-
expect(fn).toHaveBeenCalled();
|
151
|
-
});
|
152
|
-
|
153
|
-
it("#removeFunctionWithId removes a previously scheduled function with a given id during a tick", function () {
|
154
|
-
var scheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
155
|
-
fn = jasmine.createSpy('fn'),
|
156
|
-
fnDelay = 10,
|
157
|
-
timeoutKey;
|
158
|
-
|
159
|
-
scheduler.scheduleFunction(function () {
|
160
|
-
scheduler.removeFunctionWithId(timeoutKey);
|
161
|
-
}, 0);
|
162
|
-
timeoutKey = scheduler.scheduleFunction(fn, fnDelay);
|
163
|
-
|
164
|
-
expect(fn).not.toHaveBeenCalled();
|
165
|
-
|
166
|
-
scheduler.tick(fnDelay);
|
167
|
-
|
168
|
-
expect(fn).not.toHaveBeenCalled();
|
169
|
-
});
|
170
|
-
|
171
|
-
it("executes recurring functions interleaved with regular functions and functions scheduled during a tick in the correct order", function () {
|
172
|
-
var scheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
173
|
-
fn = jasmine.createSpy('fn'),
|
174
|
-
recurringCallCount = 0,
|
175
|
-
recurring = jasmine.createSpy('recurring').and.callFake(function() {
|
176
|
-
recurringCallCount++;
|
177
|
-
if (recurringCallCount < 5) {
|
178
|
-
expect(fn).not.toHaveBeenCalled();
|
179
|
-
}
|
180
|
-
}),
|
181
|
-
innerFn = jasmine.createSpy('innerFn').and.callFake(function() {
|
182
|
-
expect(recurring.calls.count()).toBe(4);
|
183
|
-
expect(fn).not.toHaveBeenCalled();
|
184
|
-
}),
|
185
|
-
scheduling = jasmine.createSpy('scheduling').and.callFake(function() {
|
186
|
-
expect(recurring.calls.count()).toBe(3);
|
187
|
-
expect(fn).not.toHaveBeenCalled();
|
188
|
-
scheduler.scheduleFunction(innerFn, 10); // 41ms absolute
|
189
|
-
});
|
190
|
-
|
191
|
-
scheduler.scheduleFunction(recurring, 10, [], true);
|
192
|
-
scheduler.scheduleFunction(fn, 50);
|
193
|
-
scheduler.scheduleFunction(scheduling, 31);
|
194
|
-
|
195
|
-
scheduler.tick(60);
|
196
|
-
|
197
|
-
expect(recurring).toHaveBeenCalled();
|
198
|
-
expect(recurring.calls.count()).toBe(6);
|
199
|
-
expect(fn).toHaveBeenCalled();
|
200
|
-
expect(scheduling).toHaveBeenCalled();
|
201
|
-
expect(innerFn).toHaveBeenCalled();
|
202
|
-
});
|
203
|
-
|
204
|
-
it("executes recurring functions after rescheduling them", function () {
|
205
|
-
var scheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
206
|
-
recurring = function() {
|
207
|
-
expect(scheduler.scheduleFunction).toHaveBeenCalled();
|
208
|
-
};
|
209
|
-
|
210
|
-
scheduler.scheduleFunction(recurring, 10, [], true);
|
211
|
-
|
212
|
-
spyOn(scheduler, "scheduleFunction");
|
213
|
-
|
214
|
-
scheduler.tick(10);
|
215
|
-
});
|
216
|
-
|
217
|
-
it("removes functions during a tick that runs the function", function() {
|
218
|
-
var scheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
219
|
-
spy = jasmine.createSpy('fn'),
|
220
|
-
spyAndRemove = jasmine.createSpy('fn'),
|
221
|
-
fnDelay = 10,
|
222
|
-
timeoutKey;
|
223
|
-
|
224
|
-
spyAndRemove.and.callFake(function() {
|
225
|
-
scheduler.removeFunctionWithId(timeoutKey);
|
226
|
-
});
|
227
|
-
|
228
|
-
scheduler.scheduleFunction(spyAndRemove, fnDelay);
|
229
|
-
|
230
|
-
timeoutKey = scheduler.scheduleFunction(spy, fnDelay, [], true);
|
231
|
-
|
232
|
-
scheduler.tick(2 * fnDelay);
|
233
|
-
|
234
|
-
expect(spy).not.toHaveBeenCalled();
|
235
|
-
expect(spyAndRemove).toHaveBeenCalled();
|
236
|
-
});
|
237
|
-
|
238
|
-
it("removes functions during the first tick that runs the function", function() {
|
239
|
-
var scheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
240
|
-
fn = jasmine.createSpy('fn'),
|
241
|
-
fnDelay = 10,
|
242
|
-
timeoutKey;
|
243
|
-
|
244
|
-
timeoutKey = scheduler.scheduleFunction(fn, fnDelay, [], true);
|
245
|
-
scheduler.scheduleFunction(function () {
|
246
|
-
scheduler.removeFunctionWithId(timeoutKey);
|
247
|
-
}, fnDelay);
|
248
|
-
|
249
|
-
expect(fn).not.toHaveBeenCalled();
|
250
|
-
|
251
|
-
scheduler.tick(3 * fnDelay);
|
252
|
-
|
253
|
-
expect(fn).toHaveBeenCalled();
|
254
|
-
expect(fn.calls.count()).toBe(1);
|
255
|
-
});
|
256
|
-
|
257
|
-
it("does not remove a function that hasn't been added yet", function() {
|
258
|
-
var scheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
259
|
-
fn = jasmine.createSpy('fn'),
|
260
|
-
fnDelay = 10,
|
261
|
-
timeoutKey;
|
262
|
-
|
263
|
-
scheduler.removeFunctionWithId('foo');
|
264
|
-
scheduler.scheduleFunction(fn, fnDelay, [], false, 'foo');
|
265
|
-
|
266
|
-
expect(fn).not.toHaveBeenCalled();
|
267
|
-
|
268
|
-
scheduler.tick(fnDelay + 1);
|
269
|
-
|
270
|
-
expect(fn).toHaveBeenCalled();
|
271
|
-
});
|
272
|
-
|
273
|
-
it("updates the mockDate per scheduled time", function () {
|
274
|
-
var scheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
275
|
-
tickDate = jasmine.createSpy('tickDate');
|
276
|
-
|
277
|
-
scheduler.scheduleFunction(function() {});
|
278
|
-
scheduler.scheduleFunction(function() {}, 1);
|
279
|
-
|
280
|
-
scheduler.tick(1, tickDate);
|
281
|
-
|
282
|
-
expect(tickDate).toHaveBeenCalledWith(0);
|
283
|
-
expect(tickDate).toHaveBeenCalledWith(1);
|
284
|
-
})
|
285
|
-
});
|
286
|
-
|
@@ -1,200 +0,0 @@
|
|
1
|
-
// TODO: Fix these unit tests!
|
2
|
-
describe("Env", function() {
|
3
|
-
var env;
|
4
|
-
beforeEach(function() {
|
5
|
-
env = new jasmineUnderTest.Env();
|
6
|
-
});
|
7
|
-
|
8
|
-
describe("#pending", function() {
|
9
|
-
it("throws the Pending Spec exception", function() {
|
10
|
-
expect(function() {
|
11
|
-
env.pending();
|
12
|
-
}).toThrow(jasmineUnderTest.Spec.pendingSpecExceptionMessage);
|
13
|
-
});
|
14
|
-
|
15
|
-
it("throws the Pending Spec exception with a custom message", function() {
|
16
|
-
expect(function() {
|
17
|
-
env.pending('custom message');
|
18
|
-
}).toThrow(jasmineUnderTest.Spec.pendingSpecExceptionMessage + 'custom message');
|
19
|
-
});
|
20
|
-
});
|
21
|
-
|
22
|
-
describe("#topSuite", function() {
|
23
|
-
it("returns the Jasmine top suite for users to traverse the spec tree", function() {
|
24
|
-
var suite = env.topSuite();
|
25
|
-
expect(suite.description).toEqual('Jasmine__TopLevel__Suite');
|
26
|
-
});
|
27
|
-
});
|
28
|
-
|
29
|
-
it('can configure specs to throw errors on expectation failures', function() {
|
30
|
-
env.throwOnExpectationFailure(true);
|
31
|
-
|
32
|
-
spyOn(jasmineUnderTest, 'Spec');
|
33
|
-
env.it('foo', function() {});
|
34
|
-
expect(jasmineUnderTest.Spec).toHaveBeenCalledWith(jasmine.objectContaining({
|
35
|
-
throwOnExpectationFailure: true
|
36
|
-
}));
|
37
|
-
});
|
38
|
-
|
39
|
-
it('can configure suites to throw errors on expectation failures', function() {
|
40
|
-
env.throwOnExpectationFailure(true);
|
41
|
-
|
42
|
-
spyOn(jasmineUnderTest, 'Suite');
|
43
|
-
env.describe('foo', function() {});
|
44
|
-
expect(jasmineUnderTest.Suite).toHaveBeenCalledWith(jasmine.objectContaining({
|
45
|
-
throwOnExpectationFailure: true
|
46
|
-
}));
|
47
|
-
});
|
48
|
-
|
49
|
-
describe('#describe', function () {
|
50
|
-
it("throws an error when given arguments", function() {
|
51
|
-
expect(function() {
|
52
|
-
env.describe('done method', function(done) {});
|
53
|
-
}).toThrowError('describe does not expect any arguments');
|
54
|
-
});
|
55
|
-
|
56
|
-
it('throws an error when it receives a non-fn argument', function() {
|
57
|
-
// Some versions of PhantomJS return [object DOMWindow] when
|
58
|
-
// Object.prototype.toString.apply is called with `undefined` or `null`.
|
59
|
-
// In a similar fashion, IE8 gives [object Object] for both `undefined`
|
60
|
-
// and `null`. We mostly just want these tests to check that using
|
61
|
-
// anything other than a function throws an error.
|
62
|
-
expect(function() {
|
63
|
-
env.describe('undefined arg', undefined);
|
64
|
-
}).toThrowError(/describe expects a function argument; received \[object (Undefined|DOMWindow|Object)\]/);
|
65
|
-
expect(function() {
|
66
|
-
env.describe('null arg', null);
|
67
|
-
}).toThrowError(/describe expects a function argument; received \[object (Null|DOMWindow|Object)\]/);
|
68
|
-
|
69
|
-
expect(function() {
|
70
|
-
env.describe('array arg', []);
|
71
|
-
}).toThrowError('describe expects a function argument; received [object Array]');
|
72
|
-
expect(function() {
|
73
|
-
env.describe('object arg', {});
|
74
|
-
}).toThrowError('describe expects a function argument; received [object Object]');
|
75
|
-
|
76
|
-
expect(function() {
|
77
|
-
env.describe('fn arg', function() {});
|
78
|
-
}).not.toThrowError('describe expects a function argument; received [object Function]');
|
79
|
-
});
|
80
|
-
});
|
81
|
-
|
82
|
-
describe('#it', function () {
|
83
|
-
it('throws an error when it receives a non-fn argument', function() {
|
84
|
-
expect(function() {
|
85
|
-
env.it('undefined arg', null);
|
86
|
-
}).toThrowError(/it expects a function argument; received \[object (Null|DOMWindow|Object)\]/);
|
87
|
-
});
|
88
|
-
|
89
|
-
it('does not throw when it is not given a fn argument', function() {
|
90
|
-
expect(function() {
|
91
|
-
env.it('pending spec');
|
92
|
-
}).not.toThrow();
|
93
|
-
});
|
94
|
-
|
95
|
-
it('accepts an async function', function() {
|
96
|
-
jasmine.getEnv().requireAsyncAwait();
|
97
|
-
expect(function() {
|
98
|
-
env.it('async', jasmine.getEnv().makeAsyncAwaitFunction());
|
99
|
-
}).not.toThrow();
|
100
|
-
});
|
101
|
-
});
|
102
|
-
|
103
|
-
describe('#xit', function() {
|
104
|
-
it('calls spec.pend with "Temporarily disabled with xit"', function() {
|
105
|
-
var pendSpy = jasmine.createSpy();
|
106
|
-
spyOn(env, 'it').and.returnValue({
|
107
|
-
pend: pendSpy
|
108
|
-
});
|
109
|
-
env.xit('foo', function() {});
|
110
|
-
expect(pendSpy).toHaveBeenCalledWith('Temporarily disabled with xit');
|
111
|
-
});
|
112
|
-
|
113
|
-
it('throws an error when it receives a non-fn argument', function() {
|
114
|
-
expect(function() {
|
115
|
-
env.xit('undefined arg', null);
|
116
|
-
}).toThrowError(/xit expects a function argument; received \[object (Null|DOMWindow|Object)\]/);
|
117
|
-
});
|
118
|
-
|
119
|
-
it('does not throw when it is not given a fn argument', function() {
|
120
|
-
expect(function() {
|
121
|
-
env.xit('pending spec');
|
122
|
-
}).not.toThrow();
|
123
|
-
});
|
124
|
-
|
125
|
-
it('accepts an async function', function() {
|
126
|
-
jasmine.getEnv().requireAsyncAwait();
|
127
|
-
expect(function() {
|
128
|
-
env.xit('async', jasmine.getEnv().makeAsyncAwaitFunction());
|
129
|
-
}).not.toThrow();
|
130
|
-
});
|
131
|
-
});
|
132
|
-
|
133
|
-
describe('#fit', function () {
|
134
|
-
it('throws an error when it receives a non-fn argument', function() {
|
135
|
-
expect(function() {
|
136
|
-
env.fit('undefined arg', undefined);
|
137
|
-
}).toThrowError(/fit expects a function argument; received \[object (Undefined|DOMWindow|Object)\]/);
|
138
|
-
});
|
139
|
-
});
|
140
|
-
|
141
|
-
describe('#beforeEach', function () {
|
142
|
-
it('throws an error when it receives a non-fn argument', function() {
|
143
|
-
expect(function() {
|
144
|
-
env.beforeEach(undefined);
|
145
|
-
}).toThrowError(/beforeEach expects a function argument; received \[object (Undefined|DOMWindow|Object)\]/);
|
146
|
-
});
|
147
|
-
|
148
|
-
it('accepts an async function', function() {
|
149
|
-
jasmine.getEnv().requireAsyncAwait();
|
150
|
-
expect(function() {
|
151
|
-
env.beforeEach(jasmine.getEnv().makeAsyncAwaitFunction());
|
152
|
-
}).not.toThrow();
|
153
|
-
});
|
154
|
-
});
|
155
|
-
|
156
|
-
describe('#beforeAll', function () {
|
157
|
-
it('throws an error when it receives a non-fn argument', function() {
|
158
|
-
expect(function() {
|
159
|
-
env.beforeAll(undefined);
|
160
|
-
}).toThrowError(/beforeAll expects a function argument; received \[object (Undefined|DOMWindow|Object)\]/);
|
161
|
-
});
|
162
|
-
|
163
|
-
it('accepts an async function', function() {
|
164
|
-
jasmine.getEnv().requireAsyncAwait();
|
165
|
-
expect(function() {
|
166
|
-
env.beforeAll(jasmine.getEnv().makeAsyncAwaitFunction());
|
167
|
-
}).not.toThrow();
|
168
|
-
});
|
169
|
-
});
|
170
|
-
|
171
|
-
describe('#afterEach', function () {
|
172
|
-
it('throws an error when it receives a non-fn argument', function() {
|
173
|
-
expect(function() {
|
174
|
-
env.afterEach(undefined);
|
175
|
-
}).toThrowError(/afterEach expects a function argument; received \[object (Undefined|DOMWindow|Object)\]/);
|
176
|
-
});
|
177
|
-
|
178
|
-
it('accepts an async function', function() {
|
179
|
-
jasmine.getEnv().requireAsyncAwait();
|
180
|
-
expect(function() {
|
181
|
-
env.afterEach(jasmine.getEnv().makeAsyncAwaitFunction());
|
182
|
-
}).not.toThrow();
|
183
|
-
});
|
184
|
-
});
|
185
|
-
|
186
|
-
describe('#afterAll', function () {
|
187
|
-
it('throws an error when it receives a non-fn argument', function() {
|
188
|
-
expect(function() {
|
189
|
-
env.afterAll(undefined);
|
190
|
-
}).toThrowError(/afterAll expects a function argument; received \[object (Undefined|DOMWindow|Object)\]/);
|
191
|
-
});
|
192
|
-
|
193
|
-
it('accepts an async function', function() {
|
194
|
-
jasmine.getEnv().requireAsyncAwait();
|
195
|
-
expect(function() {
|
196
|
-
env.afterAll(jasmine.getEnv().makeAsyncAwaitFunction());
|
197
|
-
}).not.toThrow();
|
198
|
-
});
|
199
|
-
});
|
200
|
-
});
|