UNPKG

25.9 kBJavaScriptView Raw
1'use strict';
2
3// From http://stackoverflow.com/a/728694
4function clone(obj) {
5 if (null === obj || 'object' !== typeof obj) return obj;
6 var copy = obj.constructor();
7 for (var attr in obj) {
8 if (obj.hasOwnProperty(attr)) copy[attr] = obj[attr];
9 }
10 return copy;
11}
12
13var typeEnv;
14if (!chai) {
15 var chai = require('chai');
16 var chaiImmutable = require('../chai-immutable');
17 var Immutable = require('immutable');
18
19 chai.use(chaiImmutable);
20 typeEnv = 'Node.js';
21}
22else typeEnv = 'PhantomJS';
23
24var clonedImmutable = clone(Immutable);
25
26var assert = chai.assert;
27var expect = chai.expect;
28var List = Immutable.List;
29var Map = Immutable.Map;
30var Set = Immutable.Set;
31var Stack = Immutable.Stack;
32
33/*!
34 * Test helper to check that a given function (wrapping the assertion) will
35 * fail.
36 */
37function fail(fn, msg) {
38 if (msg !== undefined) expect(fn).to.throw(chai.AssertionError, msg);
39 else expect(fn).to.throw(chai.AssertionError);
40}
41
42describe('chai-immutable (' + typeEnv + ')', function () {
43 var list3 = List.of(1, 2, 3);
44
45 var deepMap = new Map({
46 foo: 'bar',
47 list: List.of(1, 2, 3)
48 });
49
50 var sameDeepMap = new Map({
51 foo: 'bar',
52 list: List.of(1, 2, 3)
53 });
54
55 var differentDeepMap = new Map({
56 foo: 'bar',
57 list: List.of(42)
58 });
59
60 var clonedImmutableList = clonedImmutable.List.of(1, 2, 3);
61
62 describe('BDD interface', function () {
63 describe('empty property', function () {
64 it('should pass given an empty collection', function () {
65 expect(new List()).to.be.empty;
66 });
67
68 it('should pass using `not` given a non-empty collection', function () {
69 expect(list3).to.not.be.empty;
70 });
71
72 it('should not affect the original assertions', function () {
73 expect([]).to.be.empty;
74 expect('').to.be.empty;
75 expect({}).to.be.empty;
76 });
77
78 it('should fail given a non-empty collection', function () {
79 fail(function () { expect(list3).to.be.empty; });
80 });
81
82 it('should fail using `not` given an empty collection', function () {
83 fail(function () { expect(new List()).to.not.be.empty; });
84 });
85
86 it('should work if using different copies of Immutable', function () {
87 expect(clonedImmutable.List()).to.be.empty;
88 });
89 });
90
91 describe('equal method', function () {
92 it('should pass given equal values', function () {
93 expect(list3).to.equal(List.of(1, 2, 3));
94 });
95
96 it('should pass using `not` given different values', function () {
97 expect(list3).to.not.equal(new List());
98 });
99
100 it('aliases of equal should also work', function () {
101 expect(list3).to.equal(List.of(1, 2, 3));
102 expect(list3).to.not.equal(new List());
103 expect(list3).to.equals(List.of(1, 2, 3));
104 expect(list3).to.not.equals(new List());
105 expect(list3).to.eq(List.of(1, 2, 3));
106 expect(list3).to.not.eq(new List());
107 expect(list3).to.eql(List.of(1, 2, 3));
108 expect(list3).to.eqls(List.of(1, 2, 3));
109 expect(list3).to.not.eql(new List());
110 expect(list3).to.not.eqls(new List());
111 expect(list3).to.deep.equal(List.of(1, 2, 3));
112 expect(list3).to.not.deep.equal(new List());
113 });
114
115 it('should not affect the original assertions', function () {
116 expect('hello').to.equal('hello');
117 expect(42).to.equal(42);
118 expect(1).to.not.equal(true);
119 expect({ foo: 'bar' }).to.not.equal({ foo: 'bar' });
120 expect({ foo: 'bar' }).to.deep.equal({ foo: 'bar' });
121 });
122
123 it('should pass given deeply equal values', function () {
124 expect(deepMap).to.equal(sameDeepMap);
125 expect(deepMap).to.equals(sameDeepMap);
126 expect(deepMap).to.eq(sameDeepMap);
127 expect(deepMap).to.eql(sameDeepMap);
128 expect(deepMap).to.eqls(sameDeepMap);
129 expect(deepMap).to.deep.equal(sameDeepMap);
130 });
131
132 it('should pass using `not` given deeply different values', function () {
133 expect(deepMap).to.not.equal(differentDeepMap);
134 expect(deepMap).to.not.equals(differentDeepMap);
135 expect(deepMap).to.not.eq(differentDeepMap);
136 expect(deepMap).to.not.eql(differentDeepMap);
137 expect(deepMap).to.not.eqls(differentDeepMap);
138 expect(deepMap).to.not.deep.equal(differentDeepMap);
139 });
140
141 it('should pass using `not` given a non-Immutable value', function () {
142 expect([]).to.not.equal(List());
143 });
144
145 // See https://github.com/astorije/chai-immutable/issues/7
146 it('should display a helpful failure output on big objects', function () {
147 var actual = new Map({ foo: 'foo foo foo foo foo foo foo foo' });
148 var expected = new Map({ bar: 'bar bar bar bar bar bar bar bar' });
149 fail(function () {
150 expect(actual).to.equal(expected);
151 }, /(foo ?){8}.+(bar ?){8}/);
152 });
153
154 it('should fail given a non-Immutable value', function () {
155 fail(function () { expect([]).to.equal(List()); });
156 });
157
158 it('should fail given different values', function () {
159 fail(function () { expect(list3).to.equal(new List()); });
160 });
161
162 it('should fail using `not` given equal values', function () {
163 fail(function () { expect(list3).to.not.equal(List.of(1, 2, 3)); });
164 });
165
166 it('should fail given deeply different values', function () {
167 fail(function () { expect(deepMap).to.equal(differentDeepMap); });
168 fail(function () { expect(deepMap).to.equals(differentDeepMap); });
169 fail(function () { expect(deepMap).to.eq(differentDeepMap); });
170 fail(function () { expect(deepMap).to.eql(differentDeepMap); });
171 fail(function () { expect(deepMap).to.eqls(differentDeepMap); });
172 fail(function () { expect(deepMap).to.deep.equal(differentDeepMap); });
173 });
174
175 it('should fail using `not` given deeply equal values', function () {
176 fail(function () { expect(deepMap).to.not.equal(sameDeepMap); });
177 fail(function () { expect(deepMap).to.not.equals(sameDeepMap); });
178 fail(function () { expect(deepMap).to.not.eq(sameDeepMap); });
179 fail(function () { expect(deepMap).to.not.eql(sameDeepMap); });
180 fail(function () { expect(deepMap).to.not.eqls(sameDeepMap); });
181 fail(function () { expect(deepMap).to.not.deep.equal(sameDeepMap); });
182 });
183
184 it('should work if using different copies of Immutable', function () {
185 expect(clonedImmutableList).to.equal(List.of(1, 2, 3));
186 });
187 });
188
189 describe('include method', function () {
190 it('should pass given an existing value', function () {
191 expect(new List([1, 2, 3])).to.include(2);
192 });
193
194 it('should pass using `not` given an inexisting value', function () {
195 expect(new List([1, 2, 3])).to.not.include(42);
196 });
197
198 it('should chain and pass given an existing key', function () {
199 expect(new Map({
200 foo: 'bar',
201 hello: 'universe'
202 })).to.include.keys('foo');
203 });
204
205 it('should chain and pass using `not` given an inexisting key', function () {
206 expect(new Map({
207 foo: 'bar',
208 hello: 'universe'
209 })).to.not.include.keys('not-foo');
210 });
211
212 it('aliases of include should also work', function () {
213 expect(new List([1, 2, 3])).contain(2);
214 expect(new List([1, 2, 3])).not.contain(42);
215 expect(new List([1, 2, 3])).contains(2);
216 expect(new List([1, 2, 3])).not.contains(42);
217 expect(new List([1, 2, 3])).includes(2);
218 expect(new List([1, 2, 3])).not.includes(42);
219 });
220
221 it('should not affect the original assertions', function () {
222 expect([1, 2, 3]).to.include(2);
223 expect('foobar').to.contain('foo');
224 expect({ foo: 'bar', hello: 'universe' }).to.include.keys('foo');
225 });
226
227 // See https://github.com/astorije/chai-immutable/issues/7
228 it('should display a helpful failure output on big objects', function () {
229 var lengthyMap = new Map({ foo: 'foo foo foo foo foo foo foo foo ' });
230 fail(function () {
231 expect(lengthyMap).to.include('not-foo');
232 }, /(foo ){8}/);
233 });
234
235 it('should fail given an inexisting value', function () {
236 fail(function () { expect(new List([1, 2, 3])).to.include(42); });
237 });
238
239 it('should fail using `not` given an existing value', function () {
240 fail(function () { expect(new List([1, 2, 3])).not.to.include(2); });
241 });
242
243 it('should chain and fail given an inexisting key', function () {
244 fail(function () {
245 expect(new Map({
246 foo: 'bar',
247 hello: 'universe'
248 })).to.include.keys('not-foo');
249 });
250 });
251
252 it('should chain and fail using `not` given an existing key', function () {
253 fail(function () {
254 expect(new Map({
255 foo: 'bar',
256 hello: 'universe'
257 })).to.not.include.keys('foo');
258 });
259 });
260 });
261
262 describe('keys method', function () {
263 var map = new Map({ x: 1, y: 2 });
264 var obj = { x: 1, y: 2 };
265
266 it('should pass given an existing key', function () {
267 expect(new Map({ x: 1 })).to.have.key('x');
268 expect({ x: 1 }).to.have.key('x');
269 });
270
271 it('should pass using `not` given an inexisting key', function () {
272 expect(map).to.not.have.key('z');
273 expect(obj).to.not.have.key('z');
274 });
275
276 it('should pass given multiple existing keys', function () {
277 expect(map).to.have.keys('x', 'y');
278 expect(obj).to.have.keys('x', 'y');
279 });
280
281 it('should pass using `not` given multiple inexisting keys', function () {
282 expect(map).to.not.have.keys('z1', 'z2');
283 expect(obj).to.not.have.keys('z1', 'z2');
284 });
285
286 it('should accept an Array of keys to check against', function () {
287 expect(map).to.have.keys(['x', 'y']);
288 expect(obj).to.have.keys(['x', 'y']);
289 });
290
291 it('should accept a List of keys to check against', function () {
292 expect(map).to.have.keys(new List(['x', 'y']));
293 });
294
295 it('should accept a Set of keys to check against', function () {
296 expect(map).to.have.keys(new Set(['x', 'y']));
297 });
298
299 it('should accept a Stack of keys to check against', function () {
300 expect(map).to.have.keys(new Stack(['x', 'y']));
301 });
302
303 it('should accept an Object to check against', function () {
304 expect(map).to.have.keys({ 'x': 6, 'y': 7 });
305 expect(obj).to.have.keys({ 'x': 6, 'y': 7 });
306 });
307
308 it('should accept a Map to check against', function () {
309 expect(map).to.have.keys(new Map({ 'x': 6, 'y': 7 }));
310 });
311
312 it('should pass using `any` given an existing key', function () {
313 expect(map).to.have.any.keys('x', 'z');
314 expect(obj).to.have.any.keys('x', 'z');
315 });
316
317 it('should pass using `not` and `any` given inexisting keys', function () {
318 expect(map).to.not.have.any.keys('z1', 'z2');
319 expect(obj).to.not.have.any.keys('z1', 'z2');
320 });
321
322 it('should pass using `all` given existing keys', function () {
323 expect(map).to.have.all.keys('x', 'y');
324 expect(obj).to.have.all.keys('x', 'y');
325 });
326
327 it('should pass using `not` and `all` given inexisting keys', function () {
328 expect(map).to.not.have.all.keys('z1', 'y');
329 expect(obj).to.not.have.all.keys('z1', 'y');
330 });
331
332 it('should pass using `contain` given an existing key', function () {
333 expect(map).to.contain.key('x');
334 expect(obj).to.contain.key('x');
335 });
336
337 it('should not affect the original assertions', function () {
338 expect({ x: 1, y: 2 }).to.have.any.keys('x', 'z');
339 expect({ x: 1, y: 2 }).to.have.any.keys('x');
340 expect({ x: 1, y: 2 }).to.contain.any.keys('y', 'z');
341 expect({ x: 1, y: 2 }).to.contain.any.keys(['x']);
342 expect({ x: 1, y: 2 }).to.contain.any.keys({ 'x': 6 });
343 expect({ x: 1, y: 2 }).to.have.all.keys(['x', 'y']);
344 expect({ x: 1, y: 2 }).to.have.all.keys({ 'x': 6, 'y': 7 });
345 expect({ x: 1, y: 2, z: 3 }).to.contain.all.keys(['x', 'y']);
346 expect({ x: 1, y: 2, z: 3 }).to.contain.all.keys({ 'x': 6 });
347 });
348
349 // See https://github.com/astorije/chai-immutable/issues/7
350 it('should display a helpful failure output on big objects', function () {
351 var lengthyMap = new Map({ foo: 'foo foo foo foo foo foo foo foo ' });
352 fail(function () {
353 expect(lengthyMap).to.have.keys('not-foo');
354 }, /(foo ){8}/);
355 });
356
357 it('should fail given an inexisting key', function () {
358 fail(function () { expect(new Map({ x: 1 })).to.have.key('z'); });
359 fail(function () { expect({ x: 1 }).to.have.key('z'); });
360 });
361
362 it('should fail using `not` given an inexisting key', function () {
363 fail(function () { expect(map).to.not.have.key('x'); });
364 fail(function () { expect(obj).to.not.have.key('x'); });
365 });
366
367 it('should fail given multiple inexisting keys', function () {
368 fail(function () { expect(map).to.have.keys('z1', 'z2'); });
369 fail(function () { expect(obj).to.have.keys('z1', 'z2'); });
370 });
371
372 it('should fail using `not` given multiple existing keys', function () {
373 fail(function () { expect(map).to.not.have.keys('x', 'y'); });
374 fail(function () { expect(obj).to.not.have.keys('x', 'y'); });
375 });
376
377 it('should fail using `any` given inexisting keys', function () {
378 fail(function () { expect(map).to.have.any.keys('z1', 'z2'); });
379 fail(function () { expect(obj).to.have.any.keys('z1', 'z2'); });
380 });
381
382 it('should fail using `not` and `any` given an existing key', function () {
383 fail(function () { expect(map).to.not.have.any.keys('x', 'z'); });
384 fail(function () { expect(obj).to.not.have.any.keys('x', 'z'); });
385 });
386
387 it('should fail using `all` given an inexisting key', function () {
388 fail(function () { expect(map).to.have.all.keys('z1', 'y'); });
389 fail(function () { expect(obj).to.have.all.keys('z1', 'y'); });
390 });
391
392 it('should fail using `not` and `all` given existing keys', function () {
393 fail(function () { expect(map).to.not.have.all.keys('x', 'y'); });
394 fail(function () { expect(obj).to.not.have.all.keys('x', 'y'); });
395 });
396
397 it('should fail using `contain` given an inexisting key', function () {
398 fail(function () { expect(map).to.contain.key('z'); });
399 fail(function () { expect(obj).to.contain.key('z'); });
400 });
401
402 it('should work if using different copies of Immutable', function () {
403 expect(clonedImmutable.Map({ x: 1 })).to.have.key('x');
404 });
405 });
406
407 describe('size method', function () {
408 it('should pass given the right size', function () {
409 expect(list3).to.have.size(3);
410 });
411
412 it('should pass using `not` given the wrong size', function () {
413 expect(list3).to.not.have.size(42);
414 });
415
416 it('should also work with alias sizeOf', function () {
417 expect(list3).to.have.sizeOf(3);
418 expect(list3).to.not.have.sizeOf(42);
419 });
420
421 it('should fail given the wrong size', function () {
422 fail(function () { expect(list3).to.have.size(42); });
423 });
424
425 it('should fail using `not` given the right size', function () {
426 fail(function () { expect(list3).to.not.have.size(3); });
427 });
428
429 it('should work if using different copies of Immutable', function () {
430 expect(clonedImmutableList).to.have.size(3);
431 });
432 });
433
434 describe('size property', function () {
435 it('above should pass given a good min size', function () {
436 expect(list3).to.have.size.above(2);
437 });
438
439 it('above should pass using `not` given a bad min size', function () {
440 expect(list3).to.not.have.size.above(42);
441 });
442
443 it('aliases of above should also work', function () {
444 expect(list3).to.have.size.gt(2);
445 expect(list3).to.have.size.greaterThan(2);
446 expect(list3).to.not.have.size.gt(42);
447 expect(list3).to.not.have.size.greaterThan(42);
448 });
449
450 it('should not affect the original assertions of above', function () {
451 expect('foo').to.have.length.above(2);
452 expect([1, 2, 3]).to.have.length.above(2);
453 });
454
455 it('above should fail given a bad min size', function () {
456 fail(function () { expect(list3).to.have.size.above(42); });
457 });
458
459 it('above should fail using `not` given a good min size', function () {
460 fail(function () { expect(list3).to.not.have.size.above(2); });
461 });
462
463 it('below should pass given a good max size', function () {
464 expect(list3).to.have.size.below(42);
465 });
466
467 it('below should pass using `not` given a bad max size', function () {
468 expect(list3).to.not.have.size.below(1);
469 });
470
471 it('aliases of below should also work', function () {
472 expect(list3).to.have.size.lt(4);
473 expect(list3).to.have.size.lessThan(4);
474 expect(list3).to.not.have.size.lt(1);
475 expect(list3).to.not.have.size.lessThan(1);
476 });
477
478 it('should not affect the original assertions of below', function () {
479 expect('foo').to.have.length.below(4);
480 expect([1, 2, 3]).to.have.length.below(4);
481 });
482
483 it('below should fail given a bad max size', function () {
484 fail(function () { expect(list3).to.have.size.below(1); });
485 });
486
487 it('below should fail using `not` given a good max size', function () {
488 fail(function () { expect(list3).to.not.have.size.below(42); });
489 });
490
491 it('within should pass given a good range', function () {
492 expect(list3).to.have.size.within(2, 42);
493 });
494
495 it('within should pass using `not` given a bad range', function () {
496 expect(list3).to.not.have.size.within(10, 20);
497 });
498
499 it('should not affect the original assertions of within', function () {
500 expect('foo').to.have.length.within(2, 4);
501 expect([1, 2, 3]).to.have.length.within(2, 4);
502 });
503
504 it('within should fail given a bad range', function () {
505 fail(function () { expect(list3).to.have.size.within(10, 20); });
506 });
507
508 it('within should fail using `not` given a good range', function () {
509 fail(function () { expect(list3).to.not.have.size.within(2, 42); });
510 });
511
512 it('least should pass given a good min size', function () {
513 expect(list3).to.have.size.of.at.least(2);
514 });
515
516 it('least should pass using `not` given a bad min size', function () {
517 expect(list3).to.not.have.size.of.at.least(42);
518 });
519
520 it('aliases of least should also work', function () {
521 expect(list3).to.have.size.gte(2);
522 expect(list3).to.not.have.size.gte(42);
523 });
524
525 it('should not affect the original assertions of least', function () {
526 expect('foo').to.have.length.of.at.least(2);
527 expect([1, 2, 3]).to.have.length.of.at.least(3);
528 });
529
530 it('least should fail given a bad min size', function () {
531 fail(function () { expect(list3).to.have.size.of.at.least(42); });
532 });
533
534 it('least should fail using `not` given a good min size', function () {
535 fail(function () { expect(list3).to.not.have.size.of.at.least(2); });
536 });
537
538 it('most should pass given a good max size', function () {
539 expect(list3).to.have.size.of.at.most(42);
540 });
541
542 it('most should pass using `not` given a bad max size', function () {
543 expect(list3).to.not.have.size.of.at.most(2);
544 });
545
546 it('aliases of most should also work', function () {
547 expect(list3).to.have.size.lte(42);
548 expect(list3).to.not.have.size.lte(2);
549 });
550
551 it('should not affect the original assertions of most', function () {
552 expect('foo').to.have.length.of.at.most(4);
553 expect([1, 2, 3]).to.have.length.of.at.most(3);
554 });
555
556 it('most should fail given a good max size', function () {
557 fail(function () { expect(list3).to.have.size.of.at.most(2); });
558 });
559
560 it('most should fail using `not` given a bad max size', function () {
561 fail(function () { expect(list3).to.not.have.size.of.at.most(42); });
562 });
563
564 it('should work if using different copies of Immutable', function () {
565 expect(clonedImmutableList).to.have.size.above(2);
566 });
567 });
568 });
569
570 describe('TDD interface', function () {
571 describe('equal assertion', function () {
572 it('should pass given equal values', function () {
573 assert.equal(list3, List.of(1, 2, 3));
574 });
575
576 it('should pass given deeply equal values', function () {
577 assert.equal(deepMap, sameDeepMap);
578 });
579
580 it('should not affect the original assertion', function () {
581 assert.equal(42, 42);
582 assert.equal(3, '3');
583 });
584
585 // See https://github.com/astorije/chai-immutable/issues/7
586 it('should display a helpful failure output on big objects', function () {
587 var actual = new Map({ foo: 'foo foo foo foo foo foo foo foo ' });
588 var expected = new Map({ bar: 'bar bar bar bar bar bar bar bar ' });
589 fail(function () {
590 assert.equal(actual, expected);
591 }, /(foo ){8}.+(bar ){8}/);
592 });
593
594 it('should fail given a non-Immutable value', function () {
595 fail(function () { assert.equal([], List()); });
596 });
597
598 it('should fail given different values', function () {
599 fail(function () { assert.equal(list3, new List()); });
600 });
601
602 it('should fail given deeply different values', function () {
603 fail(function () { assert.equal(deepMap, differentDeepMap); });
604 });
605
606 it('should work if using different copies of Immutable', function () {
607 assert.equal(clonedImmutableList, List.of(1, 2, 3));
608 });
609 });
610
611 describe('notEqual assertion', function () {
612 it('should pass given different values', function () {
613 assert.notEqual(list3, new List());
614 });
615
616 it('should pass given deeply different values', function () {
617 assert.notEqual(deepMap, differentDeepMap);
618 });
619
620 it('should not affect the original assertion', function () {
621 assert.notEqual('oui', 'non');
622 assert.notEqual({ foo: 'bar' }, { foo: 'bar' });
623 });
624
625 it('should pass given a non-Immutable value', function () {
626 assert.notEqual([], List());
627 });
628
629 it('should fail given equal values', function () {
630 fail(function () { assert.notEqual(list3, List.of(1, 2, 3)); });
631 });
632
633 it('should fail given deeply equal values', function () {
634 fail(function () { assert.notEqual(deepMap, sameDeepMap); });
635 });
636
637 it('should work if using different copies of Immutable', function () {
638 assert.notEqual(clonedImmutableList, List.of());
639 });
640 });
641
642 describe('unoverridden strictEqual and deepEqual assertions', function () {
643 it('should pass given equal values', function () {
644 assert.strictEqual(list3, List.of(1, 2, 3));
645 assert.deepEqual(list3, List.of(1, 2, 3));
646 });
647
648 it('should pass given deeply equal values', function () {
649 assert.strictEqual(deepMap, sameDeepMap);
650 assert.deepEqual(deepMap, sameDeepMap);
651 });
652
653 it('should fail given different values', function () {
654 fail(function () { assert.strictEqual(list3, new List()); });
655 fail(function () { assert.deepEqual(list3, new List()); });
656 });
657
658 it('should fail given deeply different values', function () {
659 fail(function () { assert.strictEqual(deepMap, differentDeepMap); });
660 fail(function () { assert.deepEqual(deepMap, differentDeepMap); });
661 });
662
663 it('should work if using different copies of Immutable', function () {
664 assert.strictEqual(clonedImmutableList, List.of(1, 2, 3));
665 assert.deepEqual(clonedImmutableList, List.of(1, 2, 3));
666 });
667 });
668
669 describe('unoverridden notStrictEqual and notDeepEqual assertions', function () {
670 it('should pass given different values', function () {
671 assert.notStrictEqual(list3, new List());
672 assert.notDeepEqual(list3, new List());
673 });
674
675 it('should pass given deeply different values', function () {
676 assert.notStrictEqual(deepMap, differentDeepMap);
677 assert.notDeepEqual(deepMap, differentDeepMap);
678 });
679
680 it('should fail given equal values', function () {
681 fail(function () { assert.notStrictEqual(list3, List.of(1, 2, 3)); });
682 fail(function () { assert.notDeepEqual(list3, List.of(1, 2, 3)); });
683 });
684
685 it('should fail given deeply equal values', function () {
686 fail(function () { assert.notStrictEqual(deepMap, sameDeepMap); });
687 fail(function () { assert.notDeepEqual(deepMap, sameDeepMap); });
688 });
689
690 it('should work if using different copies of Immutable', function () {
691 assert.notStrictEqual(clonedImmutableList, List());
692 assert.notDeepEqual(clonedImmutableList, List());
693 });
694 });
695
696 describe('sizeOf assertion', function () {
697 it('should pass given the right size', function () {
698 assert.sizeOf(list3, 3);
699 });
700
701 it('should work with empty collections', function () {
702 assert.sizeOf(new List(), 0);
703 });
704
705 it('should fail given the wrong size', function () {
706 fail(function () { assert.sizeOf(list3, 42); });
707 });
708
709 it('should work if using different copies of Immutable', function () {
710 assert.sizeOf(clonedImmutableList, 3);
711 });
712 });
713 });
714});