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,441 +0,0 @@
|
|
1
|
-
describe("Spec", function() {
|
2
|
-
|
3
|
-
it("#isPendingSpecException returns true for a pending spec exception", function() {
|
4
|
-
var e = new Error(jasmineUnderTest.Spec.pendingSpecExceptionMessage);
|
5
|
-
|
6
|
-
expect(jasmineUnderTest.Spec.isPendingSpecException(e)).toBe(true);
|
7
|
-
});
|
8
|
-
|
9
|
-
it("#isPendingSpecException returns true for a pending spec exception (even when FF bug is present)", function() {
|
10
|
-
var fakeError = {
|
11
|
-
toString: function() { return "Error: " + jasmineUnderTest.Spec.pendingSpecExceptionMessage; }
|
12
|
-
};
|
13
|
-
|
14
|
-
expect(jasmineUnderTest.Spec.isPendingSpecException(fakeError)).toBe(true);
|
15
|
-
});
|
16
|
-
|
17
|
-
it("#isPendingSpecException returns true for a pending spec exception with a custom message", function() {
|
18
|
-
expect(jasmineUnderTest.Spec.isPendingSpecException(jasmineUnderTest.Spec.pendingSpecExceptionMessage + 'foo')).toBe(true);
|
19
|
-
});
|
20
|
-
|
21
|
-
it("#isPendingSpecException returns false for not a pending spec exception", function() {
|
22
|
-
var e = new Error("foo");
|
23
|
-
|
24
|
-
expect(jasmineUnderTest.Spec.isPendingSpecException(e)).toBe(false);
|
25
|
-
});
|
26
|
-
|
27
|
-
it("#isPendingSpecException returns false for thrown values that don't have toString", function() {
|
28
|
-
expect(jasmineUnderTest.Spec.isPendingSpecException(void 0)).toBe(false);
|
29
|
-
});
|
30
|
-
|
31
|
-
it("delegates execution to a QueueRunner", function() {
|
32
|
-
var fakeQueueRunner = jasmine.createSpy('fakeQueueRunner'),
|
33
|
-
spec = new jasmineUnderTest.Spec({
|
34
|
-
description: 'my test',
|
35
|
-
id: 'some-id',
|
36
|
-
queueableFn: { fn: function() {} },
|
37
|
-
queueRunnerFactory: fakeQueueRunner
|
38
|
-
});
|
39
|
-
|
40
|
-
spec.execute();
|
41
|
-
|
42
|
-
expect(fakeQueueRunner).toHaveBeenCalled();
|
43
|
-
});
|
44
|
-
|
45
|
-
it("should call the start callback on execution", function() {
|
46
|
-
var fakeQueueRunner = jasmine.createSpy('fakeQueueRunner'),
|
47
|
-
startCallback = jasmine.createSpy('startCallback'),
|
48
|
-
spec = new jasmineUnderTest.Spec({
|
49
|
-
id: 123,
|
50
|
-
description: 'foo bar',
|
51
|
-
queueableFn: { fn: function() {} },
|
52
|
-
onStart: startCallback,
|
53
|
-
queueRunnerFactory: fakeQueueRunner
|
54
|
-
});
|
55
|
-
|
56
|
-
spec.execute();
|
57
|
-
|
58
|
-
// TODO: due to some issue with the Pretty Printer, this line fails, but the other two pass.
|
59
|
-
// This means toHaveBeenCalledWith on IE8 will always be broken.
|
60
|
-
|
61
|
-
// expect(startCallback).toHaveBeenCalledWith(spec);
|
62
|
-
expect(startCallback).toHaveBeenCalled();
|
63
|
-
expect(startCallback.calls.first().object).toEqual(spec);
|
64
|
-
});
|
65
|
-
|
66
|
-
it("should call the start callback on execution but before any befores are called", function() {
|
67
|
-
var fakeQueueRunner = jasmine.createSpy('fakeQueueRunner'),
|
68
|
-
beforesWereCalled = false,
|
69
|
-
startCallback = jasmine.createSpy('start-callback').and.callFake(function() {
|
70
|
-
expect(beforesWereCalled).toBe(false);
|
71
|
-
}),
|
72
|
-
spec = new jasmineUnderTest.Spec({
|
73
|
-
queueableFn: { fn: function() {} },
|
74
|
-
beforeFns: function() {
|
75
|
-
return [function() {
|
76
|
-
beforesWereCalled = true
|
77
|
-
}]
|
78
|
-
},
|
79
|
-
onStart: startCallback,
|
80
|
-
queueRunnerFactory: fakeQueueRunner
|
81
|
-
});
|
82
|
-
|
83
|
-
spec.execute();
|
84
|
-
|
85
|
-
expect(startCallback).toHaveBeenCalled();
|
86
|
-
});
|
87
|
-
|
88
|
-
it("provides all before fns and after fns to be run", function() {
|
89
|
-
var fakeQueueRunner = jasmine.createSpy('fakeQueueRunner'),
|
90
|
-
before = jasmine.createSpy('before'),
|
91
|
-
after = jasmine.createSpy('after'),
|
92
|
-
queueableFn = { fn: jasmine.createSpy('test body').and.callFake(function() {
|
93
|
-
expect(before).toHaveBeenCalled();
|
94
|
-
expect(after).not.toHaveBeenCalled();
|
95
|
-
}) },
|
96
|
-
spec = new jasmineUnderTest.Spec({
|
97
|
-
queueableFn: queueableFn,
|
98
|
-
beforeAndAfterFns: function() {
|
99
|
-
return {befores: [before], afters: [after]}
|
100
|
-
},
|
101
|
-
queueRunnerFactory: fakeQueueRunner
|
102
|
-
});
|
103
|
-
|
104
|
-
spec.execute();
|
105
|
-
|
106
|
-
var options = fakeQueueRunner.calls.mostRecent().args[0];
|
107
|
-
expect(options.queueableFns).toEqual([before, queueableFn]);
|
108
|
-
expect(options.cleanupFns).toEqual([after]);
|
109
|
-
});
|
110
|
-
|
111
|
-
it("tells the queue runner that it's a leaf node", function() {
|
112
|
-
var fakeQueueRunner = jasmine.createSpy('fakeQueueRunner'),
|
113
|
-
spec = new jasmineUnderTest.Spec({
|
114
|
-
queueableFn: { fn: function() {} },
|
115
|
-
beforeAndAfterFns: function() {
|
116
|
-
return {befores: [], afters: []}
|
117
|
-
},
|
118
|
-
queueRunnerFactory: fakeQueueRunner
|
119
|
-
});
|
120
|
-
|
121
|
-
spec.execute();
|
122
|
-
|
123
|
-
expect(fakeQueueRunner).toHaveBeenCalledWith(jasmine.objectContaining({
|
124
|
-
isLeaf: true
|
125
|
-
}));
|
126
|
-
});
|
127
|
-
|
128
|
-
it("is marked pending if created without a function body", function() {
|
129
|
-
var fakeQueueRunner = jasmine.createSpy('fakeQueueRunner'),
|
130
|
-
|
131
|
-
startCallback = jasmine.createSpy('startCallback'),
|
132
|
-
resultCallback = jasmine.createSpy('resultCallback'),
|
133
|
-
spec = new jasmineUnderTest.Spec({
|
134
|
-
onStart: startCallback,
|
135
|
-
queueableFn: { fn: null },
|
136
|
-
resultCallback: resultCallback,
|
137
|
-
queueRunnerFactory: fakeQueueRunner
|
138
|
-
});
|
139
|
-
|
140
|
-
expect(spec.status()).toBe('pending');
|
141
|
-
});
|
142
|
-
|
143
|
-
it("can be disabled, but still calls callbacks", function() {
|
144
|
-
var fakeQueueRunner = jasmine.createSpy('fakeQueueRunner')
|
145
|
-
.and.callFake(function(attrs) { attrs.onComplete(); }),
|
146
|
-
startCallback = jasmine.createSpy('startCallback'),
|
147
|
-
specBody = jasmine.createSpy('specBody'),
|
148
|
-
resultCallback = jasmine.createSpy('resultCallback'),
|
149
|
-
spec = new jasmineUnderTest.Spec({
|
150
|
-
onStart:startCallback,
|
151
|
-
queueableFn: { fn: specBody },
|
152
|
-
resultCallback: resultCallback,
|
153
|
-
queueRunnerFactory: fakeQueueRunner
|
154
|
-
});
|
155
|
-
|
156
|
-
spec.disable();
|
157
|
-
|
158
|
-
expect(spec.status()).toBe('disabled');
|
159
|
-
|
160
|
-
spec.execute();
|
161
|
-
|
162
|
-
expect(fakeQueueRunner).toHaveBeenCalled();
|
163
|
-
expect(specBody).not.toHaveBeenCalled();
|
164
|
-
|
165
|
-
expect(startCallback).toHaveBeenCalled();
|
166
|
-
expect(resultCallback).toHaveBeenCalled();
|
167
|
-
});
|
168
|
-
|
169
|
-
it("can be disabled at execution time by a parent", function() {
|
170
|
-
var fakeQueueRunner = jasmine.createSpy('fakeQueueRunner')
|
171
|
-
.and.callFake(function(attrs) { attrs.onComplete(); }),
|
172
|
-
startCallback = jasmine.createSpy('startCallback'),
|
173
|
-
specBody = jasmine.createSpy('specBody'),
|
174
|
-
resultCallback = jasmine.createSpy('resultCallback'),
|
175
|
-
spec = new jasmineUnderTest.Spec({
|
176
|
-
onStart:startCallback,
|
177
|
-
queueableFn: { fn: specBody },
|
178
|
-
resultCallback: resultCallback,
|
179
|
-
queueRunnerFactory: fakeQueueRunner
|
180
|
-
});
|
181
|
-
|
182
|
-
spec.execute(undefined, false);
|
183
|
-
|
184
|
-
expect(spec.result.status).toBe('disabled');
|
185
|
-
|
186
|
-
expect(fakeQueueRunner).toHaveBeenCalled();
|
187
|
-
expect(specBody).not.toHaveBeenCalled();
|
188
|
-
|
189
|
-
expect(startCallback).toHaveBeenCalled();
|
190
|
-
expect(resultCallback).toHaveBeenCalled();
|
191
|
-
});
|
192
|
-
|
193
|
-
it("can be marked pending, but still calls callbacks when executed", function() {
|
194
|
-
var fakeQueueRunner = jasmine.createSpy('fakeQueueRunner')
|
195
|
-
.and.callFake(function(attrs) { attrs.onComplete(); }),
|
196
|
-
startCallback = jasmine.createSpy('startCallback'),
|
197
|
-
resultCallback = jasmine.createSpy('resultCallback'),
|
198
|
-
spec = new jasmineUnderTest.Spec({
|
199
|
-
onStart: startCallback,
|
200
|
-
resultCallback: resultCallback,
|
201
|
-
description: "with a spec",
|
202
|
-
getSpecName: function() {
|
203
|
-
return "a suite with a spec"
|
204
|
-
},
|
205
|
-
queueRunnerFactory: fakeQueueRunner,
|
206
|
-
queueableFn: { fn: null }
|
207
|
-
});
|
208
|
-
|
209
|
-
spec.pend();
|
210
|
-
|
211
|
-
expect(spec.status()).toBe('pending');
|
212
|
-
|
213
|
-
spec.execute();
|
214
|
-
|
215
|
-
expect(fakeQueueRunner).toHaveBeenCalled();
|
216
|
-
|
217
|
-
expect(startCallback).toHaveBeenCalled();
|
218
|
-
expect(resultCallback).toHaveBeenCalledWith({
|
219
|
-
id: spec.id,
|
220
|
-
status: 'pending',
|
221
|
-
description: 'with a spec',
|
222
|
-
fullName: 'a suite with a spec',
|
223
|
-
failedExpectations: [],
|
224
|
-
passedExpectations: [],
|
225
|
-
pendingReason: ''
|
226
|
-
});
|
227
|
-
});
|
228
|
-
|
229
|
-
it("should call the done callback on execution complete", function() {
|
230
|
-
var done = jasmine.createSpy('done callback'),
|
231
|
-
spec = new jasmineUnderTest.Spec({
|
232
|
-
queueableFn: { fn: function() {} },
|
233
|
-
catchExceptions: function() { return false; },
|
234
|
-
resultCallback: function() {},
|
235
|
-
queueRunnerFactory: function(attrs) { attrs.onComplete(); }
|
236
|
-
});
|
237
|
-
|
238
|
-
spec.execute(done);
|
239
|
-
|
240
|
-
expect(done).toHaveBeenCalled();
|
241
|
-
});
|
242
|
-
|
243
|
-
it("#status returns passing by default", function() {
|
244
|
-
var spec = new jasmineUnderTest.Spec({queueableFn: { fn: jasmine.createSpy("spec body")} });
|
245
|
-
expect(spec.status()).toBe('passed');
|
246
|
-
});
|
247
|
-
|
248
|
-
it("#status returns passed if all expectations in the spec have passed", function() {
|
249
|
-
var spec = new jasmineUnderTest.Spec({queueableFn: { fn: jasmine.createSpy("spec body")} });
|
250
|
-
spec.addExpectationResult(true);
|
251
|
-
expect(spec.status()).toBe('passed');
|
252
|
-
});
|
253
|
-
|
254
|
-
it("#status returns failed if any expectations in the spec have failed", function() {
|
255
|
-
var spec = new jasmineUnderTest.Spec({queueableFn: { fn: jasmine.createSpy("spec body") } });
|
256
|
-
spec.addExpectationResult(true);
|
257
|
-
spec.addExpectationResult(false);
|
258
|
-
expect(spec.status()).toBe('failed');
|
259
|
-
});
|
260
|
-
|
261
|
-
it("keeps track of passed and failed expectations", function() {
|
262
|
-
var resultCallback = jasmine.createSpy('resultCallback'),
|
263
|
-
spec = new jasmineUnderTest.Spec({
|
264
|
-
queueableFn: { fn: jasmine.createSpy("spec body") },
|
265
|
-
expectationResultFactory: function (data) { return data; },
|
266
|
-
queueRunnerFactory: function(attrs) { attrs.onComplete(); },
|
267
|
-
resultCallback: resultCallback
|
268
|
-
});
|
269
|
-
spec.addExpectationResult(true, 'expectation1');
|
270
|
-
spec.addExpectationResult(false, 'expectation2');
|
271
|
-
|
272
|
-
spec.execute();
|
273
|
-
|
274
|
-
expect(resultCallback.calls.first().args[0].passedExpectations).toEqual(['expectation1']);
|
275
|
-
expect(resultCallback.calls.first().args[0].failedExpectations).toEqual(['expectation2']);
|
276
|
-
});
|
277
|
-
|
278
|
-
it("throws an ExpectationFailed error upon receiving a failed expectation when 'throwOnExpectationFailure' is set", function() {
|
279
|
-
var resultCallback = jasmine.createSpy('resultCallback'),
|
280
|
-
spec = new jasmineUnderTest.Spec({
|
281
|
-
queueableFn: { fn: function() {} },
|
282
|
-
expectationResultFactory: function(data) { return data; },
|
283
|
-
queueRunnerFactory: function(attrs) { attrs.onComplete(); },
|
284
|
-
resultCallback: resultCallback,
|
285
|
-
throwOnExpectationFailure: true
|
286
|
-
});
|
287
|
-
|
288
|
-
spec.addExpectationResult(true, 'passed');
|
289
|
-
expect(function() {
|
290
|
-
spec.addExpectationResult(false, 'failed')
|
291
|
-
}).toThrowError(jasmineUnderTest.errors.ExpectationFailed);
|
292
|
-
|
293
|
-
spec.execute();
|
294
|
-
|
295
|
-
expect(resultCallback.calls.first().args[0].passedExpectations).toEqual(['passed']);
|
296
|
-
expect(resultCallback.calls.first().args[0].failedExpectations).toEqual(['failed']);
|
297
|
-
});
|
298
|
-
|
299
|
-
it("does not throw an ExpectationFailed error when handling an error", function() {
|
300
|
-
var resultCallback = jasmine.createSpy('resultCallback'),
|
301
|
-
spec = new jasmineUnderTest.Spec({
|
302
|
-
queueableFn: { fn: function() {} },
|
303
|
-
expectationResultFactory: function(data) { return data; },
|
304
|
-
queueRunnerFactory: function(attrs) { attrs.onComplete(); },
|
305
|
-
resultCallback: resultCallback,
|
306
|
-
throwOnExpectationFailure: true
|
307
|
-
});
|
308
|
-
|
309
|
-
spec.onException('failing exception');
|
310
|
-
});
|
311
|
-
|
312
|
-
it("can return its full name", function() {
|
313
|
-
var specNameSpy = jasmine.createSpy('specNameSpy').and.returnValue('expected val');
|
314
|
-
|
315
|
-
var spec = new jasmineUnderTest.Spec({
|
316
|
-
getSpecName: specNameSpy,
|
317
|
-
queueableFn: { fn: null }
|
318
|
-
});
|
319
|
-
|
320
|
-
expect(spec.getFullName()).toBe('expected val');
|
321
|
-
expect(specNameSpy.calls.mostRecent().args[0].id).toEqual(spec.id);
|
322
|
-
});
|
323
|
-
|
324
|
-
describe("when a spec is marked pending during execution", function() {
|
325
|
-
it("should mark the spec as pending", function() {
|
326
|
-
var fakeQueueRunner = function(opts) {
|
327
|
-
opts.onException(new Error(jasmineUnderTest.Spec.pendingSpecExceptionMessage));
|
328
|
-
},
|
329
|
-
spec = new jasmineUnderTest.Spec({
|
330
|
-
description: 'my test',
|
331
|
-
id: 'some-id',
|
332
|
-
queueableFn: { fn: function() { } },
|
333
|
-
queueRunnerFactory: fakeQueueRunner
|
334
|
-
});
|
335
|
-
|
336
|
-
spec.execute();
|
337
|
-
|
338
|
-
expect(spec.status()).toEqual("pending");
|
339
|
-
expect(spec.result.pendingReason).toEqual('');
|
340
|
-
});
|
341
|
-
|
342
|
-
it("should set the pendingReason", function() {
|
343
|
-
var fakeQueueRunner = function(opts) {
|
344
|
-
opts.onException(new Error(jasmineUnderTest.Spec.pendingSpecExceptionMessage + 'custom message'));
|
345
|
-
},
|
346
|
-
spec = new jasmineUnderTest.Spec({
|
347
|
-
description: 'my test',
|
348
|
-
id: 'some-id',
|
349
|
-
queueableFn: { fn: function() { } },
|
350
|
-
queueRunnerFactory: fakeQueueRunner
|
351
|
-
});
|
352
|
-
|
353
|
-
spec.execute();
|
354
|
-
|
355
|
-
expect(spec.status()).toEqual("pending");
|
356
|
-
expect(spec.result.pendingReason).toEqual('custom message');
|
357
|
-
});
|
358
|
-
});
|
359
|
-
|
360
|
-
it("should log a failure when handling an exception", function() {
|
361
|
-
var resultCallback = jasmine.createSpy('resultCallback'),
|
362
|
-
spec = new jasmineUnderTest.Spec({
|
363
|
-
queueableFn: { fn: function() {} },
|
364
|
-
expectationResultFactory: function(data) { return data; },
|
365
|
-
queueRunnerFactory: function(attrs) { attrs.onComplete(); },
|
366
|
-
resultCallback: resultCallback
|
367
|
-
});
|
368
|
-
|
369
|
-
spec.onException('foo');
|
370
|
-
spec.execute();
|
371
|
-
|
372
|
-
expect(resultCallback.calls.first().args[0].failedExpectations).toEqual([{
|
373
|
-
error: 'foo',
|
374
|
-
matcherName: '',
|
375
|
-
passed: false,
|
376
|
-
expected: '',
|
377
|
-
actual: ''
|
378
|
-
}]);
|
379
|
-
});
|
380
|
-
|
381
|
-
it("should not log an additional failure when handling an ExpectationFailed error", function() {
|
382
|
-
var resultCallback = jasmine.createSpy('resultCallback'),
|
383
|
-
spec = new jasmineUnderTest.Spec({
|
384
|
-
queueableFn: { fn: function() {} },
|
385
|
-
expectationResultFactory: function(data) { return data; },
|
386
|
-
queueRunnerFactory: function(attrs) { attrs.onComplete(); },
|
387
|
-
resultCallback: resultCallback
|
388
|
-
});
|
389
|
-
|
390
|
-
spec.onException(new jasmineUnderTest.errors.ExpectationFailed());
|
391
|
-
spec.execute();
|
392
|
-
|
393
|
-
expect(resultCallback.calls.first().args[0].failedExpectations).toEqual([]);
|
394
|
-
});
|
395
|
-
|
396
|
-
it("retrieves a result with updated status", function() {
|
397
|
-
var spec = new jasmineUnderTest.Spec({ queueableFn: { fn: function() {} } });
|
398
|
-
|
399
|
-
expect(spec.getResult().status).toBe('passed');
|
400
|
-
});
|
401
|
-
|
402
|
-
it("retrives a result with disabled status", function() {
|
403
|
-
var spec = new jasmineUnderTest.Spec({ queueableFn: { fn: function() {} } });
|
404
|
-
spec.disable();
|
405
|
-
|
406
|
-
expect(spec.getResult().status).toBe('disabled');
|
407
|
-
});
|
408
|
-
|
409
|
-
it("retrives a result with pending status", function() {
|
410
|
-
var spec = new jasmineUnderTest.Spec({ queueableFn: { fn: function() {} } });
|
411
|
-
spec.pend();
|
412
|
-
|
413
|
-
expect(spec.getResult().status).toBe('pending');
|
414
|
-
});
|
415
|
-
|
416
|
-
it("should not be executable when disabled", function() {
|
417
|
-
var spec = new jasmineUnderTest.Spec({
|
418
|
-
queueableFn: { fn: function() {} }
|
419
|
-
});
|
420
|
-
spec.disable();
|
421
|
-
|
422
|
-
expect(spec.isExecutable()).toBe(false);
|
423
|
-
});
|
424
|
-
|
425
|
-
it("should be executable when pending", function() {
|
426
|
-
var spec = new jasmineUnderTest.Spec({
|
427
|
-
queueableFn: { fn: function() {} }
|
428
|
-
});
|
429
|
-
spec.pend();
|
430
|
-
|
431
|
-
expect(spec.isExecutable()).toBe(true);
|
432
|
-
});
|
433
|
-
|
434
|
-
it("should be executable when not disabled or pending", function() {
|
435
|
-
var spec = new jasmineUnderTest.Spec({
|
436
|
-
queueableFn: { fn: function() {} }
|
437
|
-
});
|
438
|
-
|
439
|
-
expect(spec.isExecutable()).toBe(true);
|
440
|
-
});
|
441
|
-
});
|