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.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jasmine-core/jasmine-html.js +24 -1
  3. data/lib/jasmine-core/jasmine.css +1 -0
  4. data/lib/jasmine-core/jasmine.js +50 -6
  5. data/lib/jasmine-core/version.rb +1 -1
  6. metadata +3 -84
  7. data/lib/jasmine-core/spec/console/ConsoleReporterSpec.js +0 -270
  8. data/lib/jasmine-core/spec/core/CallTrackerSpec.js +0 -130
  9. data/lib/jasmine-core/spec/core/ClearStackSpec.js +0 -137
  10. data/lib/jasmine-core/spec/core/ClockSpec.js +0 -754
  11. data/lib/jasmine-core/spec/core/DelayedFunctionSchedulerSpec.js +0 -270
  12. data/lib/jasmine-core/spec/core/EnvSpec.js +0 -200
  13. data/lib/jasmine-core/spec/core/ExceptionFormatterSpec.js +0 -63
  14. data/lib/jasmine-core/spec/core/ExceptionsSpec.js +0 -68
  15. data/lib/jasmine-core/spec/core/ExpectationResultSpec.js +0 -61
  16. data/lib/jasmine-core/spec/core/ExpectationSpec.js +0 -434
  17. data/lib/jasmine-core/spec/core/GlobalErrorsSpec.js +0 -110
  18. data/lib/jasmine-core/spec/core/JsApiReporterSpec.js +0 -259
  19. data/lib/jasmine-core/spec/core/MockDateSpec.js +0 -200
  20. data/lib/jasmine-core/spec/core/PrettyPrintSpec.js +0 -337
  21. data/lib/jasmine-core/spec/core/QueueRunnerSpec.js +0 -620
  22. data/lib/jasmine-core/spec/core/ReportDispatcherSpec.js +0 -79
  23. data/lib/jasmine-core/spec/core/SpecSpec.js +0 -441
  24. data/lib/jasmine-core/spec/core/SpyRegistrySpec.js +0 -356
  25. data/lib/jasmine-core/spec/core/SpySpec.js +0 -127
  26. data/lib/jasmine-core/spec/core/SpyStrategySpec.js +0 -159
  27. data/lib/jasmine-core/spec/core/SuiteSpec.js +0 -155
  28. data/lib/jasmine-core/spec/core/TimerSpec.js +0 -31
  29. data/lib/jasmine-core/spec/core/TreeProcessorSpec.js +0 -756
  30. data/lib/jasmine-core/spec/core/UserContextSpec.js +0 -54
  31. data/lib/jasmine-core/spec/core/UtilSpec.js +0 -99
  32. data/lib/jasmine-core/spec/core/asymmetric_equality/AnySpec.js +0 -84
  33. data/lib/jasmine-core/spec/core/asymmetric_equality/AnythingSpec.js +0 -76
  34. data/lib/jasmine-core/spec/core/asymmetric_equality/ArrayContainingSpec.js +0 -52
  35. data/lib/jasmine-core/spec/core/asymmetric_equality/ArrayWithExactContentsSpec.js +0 -47
  36. data/lib/jasmine-core/spec/core/asymmetric_equality/ObjectContainingSpec.js +0 -102
  37. data/lib/jasmine-core/spec/core/asymmetric_equality/StringMatchingSpec.js +0 -27
  38. data/lib/jasmine-core/spec/core/formatErrorMsgSpec.js +0 -13
  39. data/lib/jasmine-core/spec/core/integration/CustomMatchersSpec.js +0 -199
  40. data/lib/jasmine-core/spec/core/integration/EnvSpec.js +0 -2007
  41. data/lib/jasmine-core/spec/core/integration/SpecRunningSpec.js +0 -950
  42. data/lib/jasmine-core/spec/core/matchers/DiffBuilderSpec.js +0 -47
  43. data/lib/jasmine-core/spec/core/matchers/NullDiffBuilderSpec.js +0 -13
  44. data/lib/jasmine-core/spec/core/matchers/ObjectPathSpec.js +0 -43
  45. data/lib/jasmine-core/spec/core/matchers/matchersUtilSpec.js +0 -658
  46. data/lib/jasmine-core/spec/core/matchers/nothingSpec.js +0 -8
  47. data/lib/jasmine-core/spec/core/matchers/toBeCloseToSpec.js +0 -93
  48. data/lib/jasmine-core/spec/core/matchers/toBeDefinedSpec.js +0 -18
  49. data/lib/jasmine-core/spec/core/matchers/toBeFalsySpec.js +0 -38
  50. data/lib/jasmine-core/spec/core/matchers/toBeGreaterThanOrEqualSpec.js +0 -29
  51. data/lib/jasmine-core/spec/core/matchers/toBeGreaterThanSpec.js +0 -20
  52. data/lib/jasmine-core/spec/core/matchers/toBeLessThanOrEqualSpec.js +0 -29
  53. data/lib/jasmine-core/spec/core/matchers/toBeLessThanSpec.js +0 -20
  54. data/lib/jasmine-core/spec/core/matchers/toBeNaNSpec.js +0 -37
  55. data/lib/jasmine-core/spec/core/matchers/toBeNegativeInfinitySpec.js +0 -31
  56. data/lib/jasmine-core/spec/core/matchers/toBeNullSpec.js +0 -17
  57. data/lib/jasmine-core/spec/core/matchers/toBePositiveInfinitySpec.js +0 -31
  58. data/lib/jasmine-core/spec/core/matchers/toBeSpec.js +0 -17
  59. data/lib/jasmine-core/spec/core/matchers/toBeTruthySpec.js +0 -38
  60. data/lib/jasmine-core/spec/core/matchers/toBeUndefinedSpec.js +0 -18
  61. data/lib/jasmine-core/spec/core/matchers/toContainSpec.js +0 -26
  62. data/lib/jasmine-core/spec/core/matchers/toEqualSpec.js +0 -804
  63. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledBeforeSpec.js +0 -99
  64. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledSpec.js +0 -47
  65. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledTimesSpec.js +0 -86
  66. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledWithSpec.js +0 -67
  67. data/lib/jasmine-core/spec/core/matchers/toMatchSpec.js +0 -43
  68. data/lib/jasmine-core/spec/core/matchers/toThrowErrorSpec.js +0 -315
  69. data/lib/jasmine-core/spec/core/matchers/toThrowSpec.js +0 -100
  70. data/lib/jasmine-core/spec/helpers/BrowserFlags.js +0 -27
  71. data/lib/jasmine-core/spec/helpers/asyncAwait.js +0 -27
  72. data/lib/jasmine-core/spec/helpers/checkForMap.js +0 -37
  73. data/lib/jasmine-core/spec/helpers/checkForSet.js +0 -41
  74. data/lib/jasmine-core/spec/helpers/checkForSymbol.js +0 -28
  75. data/lib/jasmine-core/spec/helpers/checkForTypedArrays.js +0 -20
  76. data/lib/jasmine-core/spec/helpers/defineJasmineUnderTest.js +0 -7
  77. data/lib/jasmine-core/spec/helpers/nodeDefineJasmineUnderTest.js +0 -33
  78. data/lib/jasmine-core/spec/html/HtmlReporterSpec.js +0 -982
  79. data/lib/jasmine-core/spec/html/HtmlSpecFilterSpec.js +0 -18
  80. data/lib/jasmine-core/spec/html/MatchersHtmlSpec.js +0 -37
  81. data/lib/jasmine-core/spec/html/PrettyPrintHtmlSpec.js +0 -15
  82. data/lib/jasmine-core/spec/html/QueryStringSpec.js +0 -72
  83. data/lib/jasmine-core/spec/html/ResultsNodeSpec.js +0 -62
  84. data/lib/jasmine-core/spec/html/SpyRegistryHtmlSpec.js +0 -34
  85. data/lib/jasmine-core/spec/npmPackage/npmPackageSpec.js +0 -101
  86. data/lib/jasmine-core/spec/performance/large_object_test.js +0 -36
  87. data/lib/jasmine-core/spec/performance/performance_test.js +0 -10
@@ -1,658 +0,0 @@
1
- describe("matchersUtil", function() {
2
- describe("equals", function() {
3
- it("passes for literals that are triple-equal", function() {
4
- expect(jasmineUnderTest.matchersUtil.equals(null, null)).toBe(true);
5
- expect(jasmineUnderTest.matchersUtil.equals(void 0, void 0)).toBe(true);
6
- });
7
-
8
- it("fails for things that are not equivalent", function() {
9
- expect(jasmineUnderTest.matchersUtil.equals({a: "foo"}, 1)).toBe(false);
10
- });
11
-
12
- it("passes for Strings that are equivalent", function() {
13
- expect(jasmineUnderTest.matchersUtil.equals("foo", "foo")).toBe(true);
14
- });
15
-
16
- it("fails for Strings that are not equivalent", function() {
17
- expect(jasmineUnderTest.matchersUtil.equals("foo", "bar")).toBe(false);
18
- });
19
-
20
- it("passes for Numbers that are equivalent", function() {
21
- expect(jasmineUnderTest.matchersUtil.equals(123, 123)).toBe(true);
22
- });
23
-
24
- it("fails for Numbers that are not equivalent", function() {
25
- expect(jasmineUnderTest.matchersUtil.equals(123, 456)).toBe(false);
26
- });
27
-
28
- it("passes for Dates that are equivalent", function() {
29
- expect(jasmineUnderTest.matchersUtil.equals(new Date("Jan 1, 1970"), new Date("Jan 1, 1970"))).toBe(true);
30
- });
31
-
32
- it("fails for Dates that are not equivalent", function() {
33
- expect(jasmineUnderTest.matchersUtil.equals(new Date("Jan 1, 1970"), new Date("Feb 3, 1991"))).toBe(false);
34
- });
35
-
36
- it("passes for Booleans that are equivalent", function() {
37
- expect(jasmineUnderTest.matchersUtil.equals(true, true)).toBe(true);
38
- });
39
-
40
- it("fails for Booleans that are not equivalent", function() {
41
- expect(jasmineUnderTest.matchersUtil.equals(true, false)).toBe(false);
42
- });
43
-
44
- it("passes for RegExps that are equivalent", function() {
45
- expect(jasmineUnderTest.matchersUtil.equals(/foo/, /foo/)).toBe(true);
46
- });
47
-
48
- it("fails for RegExps that are not equivalent", function() {
49
- expect(jasmineUnderTest.matchersUtil.equals(/foo/, /bar/)).toBe(false);
50
- expect(jasmineUnderTest.matchersUtil.equals(new RegExp("foo", "i"), new RegExp("foo"))).toBe(false);
51
- });
52
-
53
- it("passes for Arrays that are equivalent", function() {
54
- expect(jasmineUnderTest.matchersUtil.equals([1, 2], [1, 2])).toBe(true);
55
- });
56
-
57
- it("passes for Arrays that are equivalent, with elements added by changing length", function() {
58
- var foo = [];
59
- foo.length = 1;
60
-
61
- expect(jasmineUnderTest.matchersUtil.equals(foo, [undefined])).toBe(true);
62
- });
63
-
64
- it("fails for Arrays that have different lengths", function() {
65
- expect(jasmineUnderTest.matchersUtil.equals([1, 2], [1, 2, 3])).toBe(false);
66
- });
67
-
68
- it("fails for Arrays that have different elements", function() {
69
- expect(jasmineUnderTest.matchersUtil.equals([1, 2, 3], [1, 5, 3])).toBe(false);
70
- });
71
-
72
- it("fails for Arrays whose contents are equivalent, but have differing properties", function() {
73
- var one = [1,2,3],
74
- two = [1,2,3];
75
-
76
- one.foo = 'bar';
77
- two.foo = 'baz';
78
-
79
- expect(jasmineUnderTest.matchersUtil.equals(one, two)).toBe(false);
80
- });
81
-
82
- it("passes for Arrays with equivalent contents and properties", function() {
83
- var one = [1,2,3],
84
- two = [1,2,3];
85
-
86
- one.foo = 'bar';
87
- two.foo = 'bar';
88
-
89
- expect(jasmineUnderTest.matchersUtil.equals(one, two)).toBe(true);
90
- });
91
-
92
- it("passes for Errors that are the same type and have the same message", function() {
93
- expect(jasmineUnderTest.matchersUtil.equals(new Error("foo"), new Error("foo"))).toBe(true);
94
- });
95
-
96
- it("fails for Errors that are the same type and have different messages", function() {
97
- expect(jasmineUnderTest.matchersUtil.equals(new Error("foo"), new Error("bar"))).toBe(false);
98
- });
99
-
100
- it("fails for objects with different constructors", function() {
101
- function One() {}
102
- function Two() {}
103
-
104
- expect(jasmineUnderTest.matchersUtil.equals(new One(), new Two())).toBe(false);
105
- });
106
-
107
- it("passes for Objects that are equivalent (simple case)", function() {
108
- expect(jasmineUnderTest.matchersUtil.equals({a: "foo"}, {a: "foo"})).toBe(true);
109
- });
110
-
111
- it("fails for Objects that are not equivalent (simple case)", function() {
112
- expect(jasmineUnderTest.matchersUtil.equals({a: "foo"}, {a: "bar"})).toBe(false);
113
- });
114
-
115
- it("passes for Objects that are equivalent (deep case)", function() {
116
- expect(jasmineUnderTest.matchersUtil.equals({a: "foo", b: { c: "bar"}}, {a: "foo", b: { c: "bar"}})).toBe(true);
117
- });
118
-
119
- it("fails for Objects that are not equivalent (deep case)", function() {
120
- expect(jasmineUnderTest.matchersUtil.equals({a: "foo", b: { c: "baz"}}, {a: "foo", b: { c: "bar"}})).toBe(false);
121
- });
122
-
123
- it("passes for Objects that are equivalent (with cycles)", function() {
124
- var actual = { a: "foo" },
125
- expected = { a: "foo" };
126
-
127
- actual.b = actual;
128
- expected.b = actual;
129
-
130
- expect(jasmineUnderTest.matchersUtil.equals(actual, expected)).toBe(true);
131
- });
132
-
133
- it("fails for Objects that are not equivalent (with cycles)", function() {
134
- var actual = { a: "foo" },
135
- expected = { a: "bar" };
136
-
137
- actual.b = actual;
138
- expected.b = actual;
139
-
140
- expect(jasmineUnderTest.matchersUtil.equals(actual, expected)).toBe(false);
141
- });
142
-
143
- it("fails for Objects that have the same number of keys, but different keys/values", function () {
144
- var expected = { a: undefined },
145
- actual = { b: 1 };
146
-
147
- expect(jasmineUnderTest.matchersUtil.equals(actual, expected)).toBe(false);
148
- })
149
-
150
- it("fails when comparing an empty object to an empty array (issue #114)", function() {
151
- var emptyObject = {},
152
- emptyArray = [];
153
-
154
- expect(jasmineUnderTest.matchersUtil.equals(emptyObject, emptyArray)).toBe(false);
155
- expect(jasmineUnderTest.matchersUtil.equals(emptyArray, emptyObject)).toBe(false);
156
- });
157
-
158
- it("passes for equivalent frozen objects (GitHub issue #266)", function() {
159
- if (jasmine.getEnv().ieVersion < 9) { return; }
160
-
161
- var a = { foo: 1 },
162
- b = {foo: 1 };
163
-
164
- Object.freeze(a);
165
- Object.freeze(b);
166
-
167
- expect(jasmineUnderTest.matchersUtil.equals(a,b)).toBe(true);
168
- });
169
-
170
- it("passes for equivalent Promises (GitHub issue #1314)", function() {
171
- if (typeof Promise === 'undefined') { return; }
172
-
173
- var p1 = new Promise(function () {}),
174
- p2 = new Promise(function () {});
175
-
176
- expect(jasmineUnderTest.matchersUtil.equals(p1, p1)).toBe(true);
177
- expect(jasmineUnderTest.matchersUtil.equals(p1, p2)).toBe(false);
178
- });
179
-
180
- describe("when running in a browser", function() {
181
- function isNotRunningInBrowser() {
182
- return typeof document === 'undefined'
183
- }
184
-
185
- it("passes for equivalent DOM nodes", function() {
186
- if (isNotRunningInBrowser()) {
187
- return;
188
- }
189
- var a = document.createElement("div");
190
- a.setAttribute("test-attr", "attr-value");
191
- a.appendChild(document.createTextNode('test'));
192
-
193
- var b = document.createElement("div");
194
- b.setAttribute("test-attr", "attr-value");
195
- b.appendChild(document.createTextNode('test'));
196
-
197
- expect(jasmineUnderTest.matchersUtil.equals(a,b)).toBe(true);
198
- });
199
-
200
- it("passes for equivalent objects from different frames", function() {
201
- if (isNotRunningInBrowser()) {
202
- return;
203
- }
204
- // iframe.contentWindow.eval isn't supported in ie8
205
- if (jasmine.getEnv().ieVersion < 9) {
206
- return;
207
- }
208
- var iframe = document.createElement('iframe');
209
- document.body.appendChild(iframe);
210
- iframe.contentWindow.eval('window.testObject = {}');
211
- expect(jasmineUnderTest.matchersUtil.equals({}, iframe.contentWindow.testObject)).toBe(true);
212
- document.body.removeChild(iframe);
213
- });
214
-
215
- it("fails for DOM nodes with different attributes or child nodes", function() {
216
- if (isNotRunningInBrowser()) {
217
- return;
218
- }
219
- var a = document.createElement("div");
220
- a.setAttribute("test-attr", "attr-value")
221
- a.appendChild(document.createTextNode('test'));
222
-
223
- var b = document.createElement("div");
224
- b.setAttribute("test-attr", "attr-value2")
225
- b.appendChild(document.createTextNode('test'));
226
-
227
- expect(jasmineUnderTest.matchersUtil.equals(a,b)).toBe(false);
228
-
229
- b.setAttribute("test-attr", "attr-value");
230
- expect(jasmineUnderTest.matchersUtil.equals(a,b)).toBe(true);
231
-
232
- b.appendChild(document.createTextNode('2'));
233
- expect(jasmineUnderTest.matchersUtil.equals(a,b)).toBe(false);
234
-
235
- a.appendChild(document.createTextNode('2'));
236
- expect(jasmineUnderTest.matchersUtil.equals(a,b)).toBe(true);
237
- });
238
- });
239
-
240
- describe("when running in Node", function() {
241
- function isNotRunningInNode() {
242
- return typeof require !== 'function'
243
- }
244
-
245
- it("passes for equivalent objects from different vm contexts", function() {
246
- if (isNotRunningInNode()) {
247
- return;
248
- }
249
- var vm = require('vm');
250
- var sandbox = {
251
- obj: null
252
- };
253
- vm.runInNewContext('obj = {a: 1, b: 2}', sandbox);
254
-
255
- expect(jasmineUnderTest.matchersUtil.equals(sandbox.obj, {a: 1, b: 2})).toBe(true);
256
- });
257
-
258
- it("passes for equivalent arrays from different vm contexts", function() {
259
- if (isNotRunningInNode()) {
260
- return;
261
- }
262
- var vm = require('vm');
263
- var sandbox = {
264
- arr: null
265
- };
266
- vm.runInNewContext('arr = [1, 2]', sandbox);
267
-
268
- expect(jasmineUnderTest.matchersUtil.equals(sandbox.arr, [1, 2])).toBe(true);
269
- });
270
- });
271
-
272
- it("passes when Any is used", function() {
273
- var number = 3,
274
- anyNumber = new jasmineUnderTest.Any(Number);
275
-
276
- expect(jasmineUnderTest.matchersUtil.equals(number, anyNumber)).toBe(true);
277
- expect(jasmineUnderTest.matchersUtil.equals(anyNumber, number)).toBe(true);
278
- });
279
-
280
- it("fails when Any is compared to something unexpected", function() {
281
- var number = 3,
282
- anyString = new jasmineUnderTest.Any(String);
283
-
284
- expect(jasmineUnderTest.matchersUtil.equals(number, anyString)).toBe(false);
285
- expect(jasmineUnderTest.matchersUtil.equals(anyString, number)).toBe(false);
286
- });
287
-
288
- it("passes when ObjectContaining is used", function() {
289
- var obj = {
290
- foo: 3,
291
- bar: 7
292
- },
293
- containing = new jasmineUnderTest.ObjectContaining({foo: 3});
294
-
295
- expect(jasmineUnderTest.matchersUtil.equals(obj, containing)).toBe(true);
296
- expect(jasmineUnderTest.matchersUtil.equals(containing, obj)).toBe(true);
297
- });
298
-
299
- it("passes when an asymmetric equality tester returns true", function() {
300
- var tester = { asymmetricMatch: function(other) { return true; } };
301
-
302
- expect(jasmineUnderTest.matchersUtil.equals(false, tester)).toBe(true);
303
- expect(jasmineUnderTest.matchersUtil.equals(tester, false)).toBe(true);
304
- });
305
-
306
- it("fails when an asymmetric equality tester returns false", function() {
307
- var tester = { asymmetricMatch: function(other) { return false; } };
308
-
309
- expect(jasmineUnderTest.matchersUtil.equals(true, tester)).toBe(false);
310
- expect(jasmineUnderTest.matchersUtil.equals(tester, true)).toBe(false);
311
- });
312
-
313
- it("passes when ArrayContaining is used", function() {
314
- var arr = ["foo", "bar"];
315
-
316
- expect(jasmineUnderTest.matchersUtil.equals(arr, new jasmineUnderTest.ArrayContaining(["bar"]))).toBe(true);
317
- });
318
-
319
- it("passes when a custom equality matcher returns true", function() {
320
- var tester = function(a, b) { return true; };
321
-
322
- expect(jasmineUnderTest.matchersUtil.equals(1, 2, [tester])).toBe(true);
323
- });
324
-
325
- it("passes for two empty Objects", function () {
326
- expect(jasmineUnderTest.matchersUtil.equals({}, {})).toBe(true);
327
- });
328
-
329
- describe("when a custom equality matcher is installed that returns 'undefined'", function () {
330
- var tester = function(a, b) { return jasmine.undefined; };
331
-
332
- it("passes for two empty Objects", function () {
333
- expect(jasmineUnderTest.matchersUtil.equals({}, {}, [tester])).toBe(true);
334
- });
335
- });
336
-
337
- it("fails for equivalents when a custom equality matcher returns false", function() {
338
- var tester = function(a, b) { return false; };
339
-
340
- expect(jasmineUnderTest.matchersUtil.equals(1, 1, [tester])).toBe(false);
341
- });
342
-
343
- it("passes for an asymmetric equality tester that returns true when a custom equality tester return false", function() {
344
- var asymmetricTester = { asymmetricMatch: function(other) { return true; } },
345
- symmetricTester = function(a, b) { return false; };
346
-
347
- expect(jasmineUnderTest.matchersUtil.equals(asymmetricTester, true, [symmetricTester])).toBe(true);
348
- expect(jasmineUnderTest.matchersUtil.equals(true, asymmetricTester, [symmetricTester])).toBe(true);
349
- });
350
-
351
- it("passes custom equality matchers to asymmetric equality testers", function() {
352
- var tester = function(a, b) {};
353
- var asymmetricTester = { asymmetricMatch: jasmine.createSpy('asymmetricMatch') };
354
- asymmetricTester.asymmetricMatch.and.returnValue(true);
355
- var other = {};
356
-
357
- expect(jasmineUnderTest.matchersUtil.equals(asymmetricTester, other, [tester])).toBe(true);
358
- expect(asymmetricTester.asymmetricMatch).toHaveBeenCalledWith(other, [tester]);
359
- });
360
-
361
- it("passes when an Any is compared to an Any that checks for the same type", function() {
362
- var any1 = new jasmineUnderTest.Any(Function),
363
- any2 = new jasmineUnderTest.Any(Function);
364
-
365
- expect(jasmineUnderTest.matchersUtil.equals(any1, any2)).toBe(true);
366
- });
367
-
368
- it("passes for null prototype objects with same properties", function () {
369
- if (jasmine.getEnv().ieVersion < 9) { return; }
370
-
371
- var objA = Object.create(null),
372
- objB = Object.create(null);
373
-
374
- objA.name = 'test';
375
- objB.name = 'test';
376
-
377
- expect(jasmineUnderTest.matchersUtil.equals(objA, objB)).toBe(true);
378
- });
379
-
380
- it("fails for null prototype objects with different properties", function () {
381
- if (jasmine.getEnv().ieVersion < 9) { return; }
382
-
383
- var objA = Object.create(null),
384
- objB = Object.create(null);
385
-
386
- objA.name = 'test';
387
- objB.test = 'name';
388
-
389
- expect(jasmineUnderTest.matchersUtil.equals(objA, objB)).toBe(false);
390
- });
391
-
392
- it("passes when comparing two empty sets", function() {
393
- jasmine.getEnv().requireFunctioningSets();
394
- expect(jasmineUnderTest.matchersUtil.equals(new Set(), new Set())).toBe(true);
395
- });
396
-
397
- it("passes when comparing identical sets", function() {
398
- jasmine.getEnv().requireFunctioningSets();
399
-
400
- var setA = new Set();
401
- setA.add(6);
402
- setA.add(5);
403
- var setB = new Set();
404
- setB.add(6);
405
- setB.add(5);
406
-
407
- expect(jasmineUnderTest.matchersUtil.equals(setA, setB)).toBe(true);
408
- });
409
-
410
- it("passes when comparing identical sets with different insertion order and simple elements", function() {
411
- jasmine.getEnv().requireFunctioningSets();
412
-
413
- var setA = new Set();
414
- setA.add(3);
415
- setA.add(6);
416
- var setB = new Set();
417
- setB.add(6);
418
- setB.add(3);
419
-
420
- expect(jasmineUnderTest.matchersUtil.equals(setA, setB)).toBe(true);
421
- });
422
-
423
- it("passes when comparing identical sets with different insertion order and complex elements 1", function() {
424
- jasmine.getEnv().requireFunctioningSets();
425
-
426
- var setA1 = new Set();
427
- setA1.add(['a',3]);
428
- setA1.add([6,1]);
429
- var setA2 = new Set();
430
- setA1.add(['y',3]);
431
- setA1.add([6,1]);
432
- var setA = new Set();
433
- setA.add(setA1);
434
- setA.add(setA2);
435
-
436
-
437
- var setB1 = new Set();
438
- setB1.add([6,1]);
439
- setB1.add(['a',3]);
440
- var setB2 = new Set();
441
- setB1.add([6,1]);
442
- setB1.add(['y',3]);
443
- var setB = new Set();
444
- setB.add(setB1);
445
- setB.add(setB2);
446
-
447
- expect(jasmineUnderTest.matchersUtil.equals(setA, setB)).toBe(true);
448
- });
449
-
450
- it("passes when comparing identical sets with different insertion order and complex elements 2", function() {
451
- jasmine.getEnv().requireFunctioningSets();
452
-
453
- var setA = new Set();
454
- setA.add([[1,2], [3,4]]);
455
- setA.add([[5,6], [7,8]]);
456
- var setB = new Set();
457
- setB.add([[5,6], [7,8]]);
458
- setB.add([[1,2], [3,4]]);
459
-
460
- expect(jasmineUnderTest.matchersUtil.equals(setA, setB)).toBe(true);
461
- });
462
-
463
- it("fails for sets with different elements", function() {
464
- jasmine.getEnv().requireFunctioningSets();
465
- var setA = new Set();
466
- setA.add(6);
467
- setA.add(3);
468
- setA.add(5);
469
- var setB = new Set();
470
- setB.add(6);
471
- setB.add(4);
472
- setB.add(5);
473
-
474
- expect(jasmineUnderTest.matchersUtil.equals(setA, setB)).toBe(false);
475
- });
476
-
477
- it("fails for sets of different size", function() {
478
- jasmine.getEnv().requireFunctioningSets();
479
- var setA = new Set();
480
- setA.add(6);
481
- setA.add(3);
482
- var setB = new Set();
483
- setB.add(6);
484
- setB.add(4);
485
- setB.add(5);
486
-
487
- expect(jasmineUnderTest.matchersUtil.equals(setA, setB)).toBe(false);
488
- });
489
-
490
- it("passes when comparing two empty maps", function() {
491
- jasmine.getEnv().requireFunctioningMaps();
492
- expect(jasmineUnderTest.matchersUtil.equals(new Map(), new Map())).toBe(true);
493
- });
494
-
495
- it("passes when comparing identical maps", function() {
496
- jasmine.getEnv().requireFunctioningMaps();
497
- var mapA = new Map();
498
- mapA.set(6, 5);
499
- var mapB = new Map();
500
- mapB.set(6, 5);
501
- expect(jasmineUnderTest.matchersUtil.equals(mapA, mapB)).toBe(true);
502
- });
503
-
504
- it("passes when comparing identical maps with different insertion order", function() {
505
- jasmine.getEnv().requireFunctioningMaps();
506
- var mapA = new Map();
507
- mapA.set("a", 3);
508
- mapA.set(6, 1);
509
- var mapB = new Map();
510
- mapB.set(6, 1);
511
- mapB.set("a", 3);
512
- expect(jasmineUnderTest.matchersUtil.equals(mapA, mapB)).toBe(true);
513
- });
514
-
515
- it("fails for maps with different elements", function() {
516
- jasmine.getEnv().requireFunctioningMaps();
517
- var mapA = new Map();
518
- mapA.set(6, 3);
519
- mapA.set(5, 1);
520
- var mapB = new Map();
521
- mapB.set(6, 4);
522
- mapB.set(5, 1);
523
-
524
- expect(jasmineUnderTest.matchersUtil.equals(mapA, mapB)).toBe(false);
525
- });
526
-
527
- it("fails for maps of different size", function() {
528
- jasmine.getEnv().requireFunctioningMaps();
529
- var mapA = new Map();
530
- mapA.set(6, 3);
531
- var mapB = new Map();
532
- mapB.set(6, 4);
533
- mapB.set(5, 1);
534
- expect(jasmineUnderTest.matchersUtil.equals(mapA, mapB)).toBe(false);
535
- });
536
-
537
- describe("when running in an environment with array polyfills", function() {
538
- // IE 8 doesn't support `definePropery` on non-DOM nodes
539
- if (jasmine.getEnv().ieVersion < 9) { return; }
540
-
541
- var findIndexDescriptor = Object.getOwnPropertyDescriptor(Array.prototype, 'findIndex');
542
- if (!findIndexDescriptor) {
543
- return;
544
- }
545
-
546
- beforeEach(function() {
547
- Object.defineProperty(Array.prototype, 'findIndex', {
548
- enumerable: true,
549
- value: function (predicate) {
550
- if (this === null) {
551
- throw new TypeError('Array.prototype.findIndex called on null or undefined');
552
- }
553
-
554
- if (typeof predicate !== 'function') {
555
- throw new TypeError('predicate must be a function');
556
- }
557
-
558
- var list = Object(this);
559
- var length = list.length >>> 0;
560
- var thisArg = arguments[1];
561
- var value;
562
-
563
- for (var i = 0; i < length; i++) {
564
- value = list[i];
565
- if (predicate.call(thisArg, value, i, list)) {
566
- return i;
567
- }
568
- }
569
-
570
- return -1;
571
- }
572
- });
573
- });
574
-
575
- afterEach(function() {
576
- Object.defineProperty(Array.prototype, 'findIndex', findIndexDescriptor);
577
- });
578
-
579
- it("passes when there's an array polyfill", function() {
580
- expect(['foo']).toEqual(['foo']);
581
- });
582
- });
583
- });
584
-
585
- describe("contains", function() {
586
- it("passes when expected is a substring of actual", function() {
587
- expect(jasmineUnderTest.matchersUtil.contains("ABC", "BC")).toBe(true);
588
- });
589
-
590
- it("fails when expected is a not substring of actual", function() {
591
- expect(jasmineUnderTest.matchersUtil.contains("ABC", "X")).toBe(false);
592
- });
593
-
594
- it("passes when expected is an element in an actual array", function() {
595
- expect(jasmineUnderTest.matchersUtil.contains(['foo', 'bar'], 'foo')).toBe(true);
596
- });
597
-
598
- it("fails when expected is not an element in an actual array", function() {
599
- expect(jasmineUnderTest.matchersUtil.contains(['foo', 'bar'], 'baz')).toBe(false);
600
- });
601
-
602
- it("passes with mixed-element arrays", function() {
603
- expect(jasmineUnderTest.matchersUtil.contains(["foo", {some: "bar"}], "foo")).toBe(true);
604
- expect(jasmineUnderTest.matchersUtil.contains(["foo", {some: "bar"}], {some: "bar"})).toBe(true);
605
- });
606
-
607
- it("uses custom equality testers if passed in and actual is an Array", function() {
608
- var customTester = function(a, b) {return true;};
609
-
610
- expect(jasmineUnderTest.matchersUtil.contains([1, 2], 2, [customTester])).toBe(true);
611
- });
612
-
613
- it("fails when actual is undefined", function() {
614
- expect(jasmineUnderTest.matchersUtil.contains(undefined, 'A')).toBe(false);
615
- });
616
-
617
- it("fails when actual is null", function() {
618
- expect(jasmineUnderTest.matchersUtil.contains(null, 'A')).toBe(false);
619
- });
620
-
621
- it("passes with array-like objects", function() {
622
- var capturedArgs = null;
623
- function testFunction(){
624
- capturedArgs = arguments;
625
- }
626
- testFunction('foo', 'bar');
627
- expect(jasmineUnderTest.matchersUtil.contains(capturedArgs, 'bar')).toBe(true);
628
- });
629
- });
630
-
631
- describe("buildMessage", function() {
632
-
633
- it("builds an English sentence for a failure case", function() {
634
- var actual = "foo",
635
- name = "toBar",
636
- message = jasmineUnderTest.matchersUtil.buildFailureMessage(name, false, actual);
637
-
638
- expect(message).toEqual("Expected 'foo' to bar.");
639
- });
640
-
641
- it("builds an English sentence for a 'not' failure case", function() {
642
- var actual = "foo",
643
- name = "toBar",
644
- isNot = true,
645
- message = message = jasmineUnderTest.matchersUtil.buildFailureMessage(name, isNot, actual);
646
-
647
- expect(message).toEqual("Expected 'foo' not to bar.");
648
- });
649
-
650
- it("builds an English sentence for an arbitrary array of expected arguments", function() {
651
- var actual = "foo",
652
- name = "toBar",
653
- message = jasmineUnderTest.matchersUtil.buildFailureMessage(name, false, actual, "quux", "corge");
654
-
655
- expect(message).toEqual("Expected 'foo' to bar 'quux', 'corge'.");
656
- });
657
- });
658
- });
@@ -1,8 +0,0 @@
1
- describe('nothing', function() {
2
- it('should pass', function() {
3
- var matcher = jasmineUnderTest.matchers.nothing(),
4
- result = matcher.compare();
5
-
6
- expect(result.pass).toBe(true);
7
- });
8
- });