chai 3.2.0 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CODE_OF_CONDUCT.md +58 -0
- package/CONTRIBUTING.md +11 -3
- package/README.md +3 -1
- package/chai.js +593 -73
- package/lib/chai/assertion.js +2 -2
- package/lib/chai/core/assertions.js +148 -17
- package/lib/chai/interface/assert.js +225 -18
- package/lib/chai/interface/expect.js +1 -0
- package/lib/chai/interface/should.js +103 -0
- package/lib/chai/utils/addChainableMethod.js +1 -0
- package/lib/chai/utils/addMethod.js +1 -0
- package/lib/chai/utils/addProperty.js +9 -1
- package/lib/chai/utils/expectTypes.js +42 -0
- package/lib/chai/utils/flag.js +1 -0
- package/lib/chai/utils/getActual.js +2 -0
- package/lib/chai/utils/getEnumerableProperties.js +1 -0
- package/lib/chai/utils/getMessage.js +4 -3
- package/lib/chai/utils/getName.js +2 -0
- package/lib/chai/utils/getPathInfo.js +1 -0
- package/lib/chai/utils/getPathValue.js +2 -1
- package/lib/chai/utils/getProperties.js +1 -0
- package/lib/chai/utils/hasProperty.js +2 -1
- package/lib/chai/utils/index.js +5 -1
- package/lib/chai/utils/inspect.js +2 -0
- package/lib/chai/utils/objDisplay.js +1 -0
- package/lib/chai/utils/overwriteChainableMethod.js +1 -0
- package/lib/chai/utils/overwriteMethod.js +1 -0
- package/lib/chai/utils/overwriteProperty.js +1 -0
- package/lib/chai/utils/test.js +2 -0
- package/lib/chai/utils/transferFlags.js +1 -0
- package/lib/chai.js +1 -1
- package/package.json +2 -2
|
@@ -29,6 +29,7 @@ module.exports = function (chai, util) {
|
|
|
29
29
|
* @param {Mixed} expression to test for truthiness
|
|
30
30
|
* @param {String} message to display on error
|
|
31
31
|
* @name assert
|
|
32
|
+
* @namespace Assert
|
|
32
33
|
* @api public
|
|
33
34
|
*/
|
|
34
35
|
|
|
@@ -51,6 +52,7 @@ module.exports = function (chai, util) {
|
|
|
51
52
|
* @param {Mixed} expected
|
|
52
53
|
* @param {String} message
|
|
53
54
|
* @param {String} operator
|
|
55
|
+
* @namespace Assert
|
|
54
56
|
* @api public
|
|
55
57
|
*/
|
|
56
58
|
|
|
@@ -75,6 +77,7 @@ module.exports = function (chai, util) {
|
|
|
75
77
|
* @alias ok
|
|
76
78
|
* @param {Mixed} object to test
|
|
77
79
|
* @param {String} message
|
|
80
|
+
* @namespace Assert
|
|
78
81
|
* @api public
|
|
79
82
|
*/
|
|
80
83
|
|
|
@@ -94,6 +97,7 @@ module.exports = function (chai, util) {
|
|
|
94
97
|
* @alias notOk
|
|
95
98
|
* @param {Mixed} object to test
|
|
96
99
|
* @param {String} message
|
|
100
|
+
* @namespace Assert
|
|
97
101
|
* @api public
|
|
98
102
|
*/
|
|
99
103
|
|
|
@@ -112,6 +116,7 @@ module.exports = function (chai, util) {
|
|
|
112
116
|
* @param {Mixed} actual
|
|
113
117
|
* @param {Mixed} expected
|
|
114
118
|
* @param {String} message
|
|
119
|
+
* @namespace Assert
|
|
115
120
|
* @api public
|
|
116
121
|
*/
|
|
117
122
|
|
|
@@ -138,6 +143,7 @@ module.exports = function (chai, util) {
|
|
|
138
143
|
* @param {Mixed} actual
|
|
139
144
|
* @param {Mixed} expected
|
|
140
145
|
* @param {String} message
|
|
146
|
+
* @namespace Assert
|
|
141
147
|
* @api public
|
|
142
148
|
*/
|
|
143
149
|
|
|
@@ -164,6 +170,7 @@ module.exports = function (chai, util) {
|
|
|
164
170
|
* @param {Mixed} actual
|
|
165
171
|
* @param {Mixed} expected
|
|
166
172
|
* @param {String} message
|
|
173
|
+
* @namespace Assert
|
|
167
174
|
* @api public
|
|
168
175
|
*/
|
|
169
176
|
|
|
@@ -182,6 +189,7 @@ module.exports = function (chai, util) {
|
|
|
182
189
|
* @param {Mixed} actual
|
|
183
190
|
* @param {Mixed} expected
|
|
184
191
|
* @param {String} message
|
|
192
|
+
* @namespace Assert
|
|
185
193
|
* @api public
|
|
186
194
|
*/
|
|
187
195
|
|
|
@@ -200,6 +208,7 @@ module.exports = function (chai, util) {
|
|
|
200
208
|
* @param {Mixed} actual
|
|
201
209
|
* @param {Mixed} expected
|
|
202
210
|
* @param {String} message
|
|
211
|
+
* @namespace Assert
|
|
203
212
|
* @api public
|
|
204
213
|
*/
|
|
205
214
|
|
|
@@ -218,6 +227,7 @@ module.exports = function (chai, util) {
|
|
|
218
227
|
* @param {Mixed} actual
|
|
219
228
|
* @param {Mixed} expected
|
|
220
229
|
* @param {String} message
|
|
230
|
+
* @namespace Assert
|
|
221
231
|
* @api public
|
|
222
232
|
*/
|
|
223
233
|
|
|
@@ -225,17 +235,18 @@ module.exports = function (chai, util) {
|
|
|
225
235
|
new Assertion(act, msg).to.not.eql(exp);
|
|
226
236
|
};
|
|
227
237
|
|
|
228
|
-
|
|
229
|
-
* ### .
|
|
238
|
+
/**
|
|
239
|
+
* ### .isAbove(valueToCheck, valueToBeAbove, [message])
|
|
230
240
|
*
|
|
231
|
-
* Asserts
|
|
241
|
+
* Asserts `valueToCheck` is strictly greater than (>) `valueToBeAbove`
|
|
232
242
|
*
|
|
233
|
-
*
|
|
234
|
-
* assert.isTrue(teaServed, 'the tea has been served');
|
|
243
|
+
* assert.isAbove(5, 2, '5 is strictly greater than 2');
|
|
235
244
|
*
|
|
236
|
-
* @name
|
|
237
|
-
* @param {Mixed}
|
|
245
|
+
* @name isAbove
|
|
246
|
+
* @param {Mixed} valueToCheck
|
|
247
|
+
* @param {Mixed} valueToBeAbove
|
|
238
248
|
* @param {String} message
|
|
249
|
+
* @namespace Assert
|
|
239
250
|
* @api public
|
|
240
251
|
*/
|
|
241
252
|
|
|
@@ -244,21 +255,23 @@ module.exports = function (chai, util) {
|
|
|
244
255
|
};
|
|
245
256
|
|
|
246
257
|
/**
|
|
247
|
-
* ### .
|
|
258
|
+
* ### .isAtLeast(valueToCheck, valueToBeAtLeast, [message])
|
|
248
259
|
*
|
|
249
|
-
* Asserts `valueToCheck` is
|
|
260
|
+
* Asserts `valueToCheck` is greater than or equal to (>=) `valueToBeAtLeast`
|
|
250
261
|
*
|
|
251
|
-
* assert.
|
|
262
|
+
* assert.isAtLeast(5, 2, '5 is greater or equal to 2');
|
|
263
|
+
* assert.isAtLeast(3, 3, '3 is greater or equal to 3');
|
|
252
264
|
*
|
|
253
|
-
* @name
|
|
265
|
+
* @name isAtLeast
|
|
254
266
|
* @param {Mixed} valueToCheck
|
|
255
|
-
* @param {Mixed}
|
|
267
|
+
* @param {Mixed} valueToBeAtLeast
|
|
256
268
|
* @param {String} message
|
|
269
|
+
* @namespace Assert
|
|
257
270
|
* @api public
|
|
258
271
|
*/
|
|
259
272
|
|
|
260
|
-
assert.
|
|
261
|
-
new Assertion(val, msg).to.be.
|
|
273
|
+
assert.isAtLeast = function (val, atlst, msg) {
|
|
274
|
+
new Assertion(val, msg).to.be.least(atlst);
|
|
262
275
|
};
|
|
263
276
|
|
|
264
277
|
/**
|
|
@@ -272,6 +285,46 @@ module.exports = function (chai, util) {
|
|
|
272
285
|
* @param {Mixed} valueToCheck
|
|
273
286
|
* @param {Mixed} valueToBeBelow
|
|
274
287
|
* @param {String} message
|
|
288
|
+
* @namespace Assert
|
|
289
|
+
* @api public
|
|
290
|
+
*/
|
|
291
|
+
|
|
292
|
+
assert.isBelow = function (val, blw, msg) {
|
|
293
|
+
new Assertion(val, msg).to.be.below(blw);
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* ### .isAtMost(valueToCheck, valueToBeAtMost, [message])
|
|
298
|
+
*
|
|
299
|
+
* Asserts `valueToCheck` is less than or equal to (<=) `valueToBeAtMost`
|
|
300
|
+
*
|
|
301
|
+
* assert.isAtMost(3, 6, '3 is less than or equal to 6');
|
|
302
|
+
* assert.isAtMost(4, 4, '4 is less than or equal to 4');
|
|
303
|
+
*
|
|
304
|
+
* @name isAtMost
|
|
305
|
+
* @param {Mixed} valueToCheck
|
|
306
|
+
* @param {Mixed} valueToBeAtMost
|
|
307
|
+
* @param {String} message
|
|
308
|
+
* @namespace Assert
|
|
309
|
+
* @api public
|
|
310
|
+
*/
|
|
311
|
+
|
|
312
|
+
assert.isAtMost = function (val, atmst, msg) {
|
|
313
|
+
new Assertion(val, msg).to.be.most(atmst);
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* ### .isTrue(value, [message])
|
|
318
|
+
*
|
|
319
|
+
* Asserts that `value` is true.
|
|
320
|
+
*
|
|
321
|
+
* var teaServed = true;
|
|
322
|
+
* assert.isTrue(teaServed, 'the tea has been served');
|
|
323
|
+
*
|
|
324
|
+
* @name isTrue
|
|
325
|
+
* @param {Mixed} value
|
|
326
|
+
* @param {String} message
|
|
327
|
+
* @namespace Assert
|
|
275
328
|
* @api public
|
|
276
329
|
*/
|
|
277
330
|
|
|
@@ -279,6 +332,25 @@ module.exports = function (chai, util) {
|
|
|
279
332
|
new Assertion(val, msg).is['true'];
|
|
280
333
|
};
|
|
281
334
|
|
|
335
|
+
/**
|
|
336
|
+
* ### .isNotTrue(value, [message])
|
|
337
|
+
*
|
|
338
|
+
* Asserts that `value` is not true.
|
|
339
|
+
*
|
|
340
|
+
* var tea = 'tasty chai';
|
|
341
|
+
* assert.isNotTrue(tea, 'great, time for tea!');
|
|
342
|
+
*
|
|
343
|
+
* @name isNotTrue
|
|
344
|
+
* @param {Mixed} value
|
|
345
|
+
* @param {String} message
|
|
346
|
+
* @namespace Assert
|
|
347
|
+
* @api public
|
|
348
|
+
*/
|
|
349
|
+
|
|
350
|
+
assert.isNotTrue = function (val, msg) {
|
|
351
|
+
new Assertion(val, msg).to.not.equal(true);
|
|
352
|
+
};
|
|
353
|
+
|
|
282
354
|
/**
|
|
283
355
|
* ### .isFalse(value, [message])
|
|
284
356
|
*
|
|
@@ -290,6 +362,7 @@ module.exports = function (chai, util) {
|
|
|
290
362
|
* @name isFalse
|
|
291
363
|
* @param {Mixed} value
|
|
292
364
|
* @param {String} message
|
|
365
|
+
* @namespace Assert
|
|
293
366
|
* @api public
|
|
294
367
|
*/
|
|
295
368
|
|
|
@@ -297,6 +370,25 @@ module.exports = function (chai, util) {
|
|
|
297
370
|
new Assertion(val, msg).is['false'];
|
|
298
371
|
};
|
|
299
372
|
|
|
373
|
+
/**
|
|
374
|
+
* ### .isNotFalse(value, [message])
|
|
375
|
+
*
|
|
376
|
+
* Asserts that `value` is not false.
|
|
377
|
+
*
|
|
378
|
+
* var tea = 'tasty chai';
|
|
379
|
+
* assert.isNotFalse(tea, 'great, time for tea!');
|
|
380
|
+
*
|
|
381
|
+
* @name isNotFalse
|
|
382
|
+
* @param {Mixed} value
|
|
383
|
+
* @param {String} message
|
|
384
|
+
* @namespace Assert
|
|
385
|
+
* @api public
|
|
386
|
+
*/
|
|
387
|
+
|
|
388
|
+
assert.isNotFalse = function (val, msg) {
|
|
389
|
+
new Assertion(val, msg).to.not.equal(false);
|
|
390
|
+
};
|
|
391
|
+
|
|
300
392
|
/**
|
|
301
393
|
* ### .isNull(value, [message])
|
|
302
394
|
*
|
|
@@ -307,6 +399,7 @@ module.exports = function (chai, util) {
|
|
|
307
399
|
* @name isNull
|
|
308
400
|
* @param {Mixed} value
|
|
309
401
|
* @param {String} message
|
|
402
|
+
* @namespace Assert
|
|
310
403
|
* @api public
|
|
311
404
|
*/
|
|
312
405
|
|
|
@@ -325,6 +418,7 @@ module.exports = function (chai, util) {
|
|
|
325
418
|
* @name isNotNull
|
|
326
419
|
* @param {Mixed} value
|
|
327
420
|
* @param {String} message
|
|
421
|
+
* @namespace Assert
|
|
328
422
|
* @api public
|
|
329
423
|
*/
|
|
330
424
|
|
|
@@ -341,6 +435,7 @@ module.exports = function (chai, util) {
|
|
|
341
435
|
* @name isNaN
|
|
342
436
|
* @param {Mixed} value
|
|
343
437
|
* @param {String} message
|
|
438
|
+
* @namespace Assert
|
|
344
439
|
* @api public
|
|
345
440
|
*/
|
|
346
441
|
|
|
@@ -357,6 +452,7 @@ module.exports = function (chai, util) {
|
|
|
357
452
|
* @name isNotNaN
|
|
358
453
|
* @param {Mixed} value
|
|
359
454
|
* @param {String} message
|
|
455
|
+
* @namespace Assert
|
|
360
456
|
* @api public
|
|
361
457
|
*/
|
|
362
458
|
assert.isNotNaN = function (val, msg) {
|
|
@@ -374,6 +470,7 @@ module.exports = function (chai, util) {
|
|
|
374
470
|
* @name isUndefined
|
|
375
471
|
* @param {Mixed} value
|
|
376
472
|
* @param {String} message
|
|
473
|
+
* @namespace Assert
|
|
377
474
|
* @api public
|
|
378
475
|
*/
|
|
379
476
|
|
|
@@ -392,6 +489,7 @@ module.exports = function (chai, util) {
|
|
|
392
489
|
* @name isDefined
|
|
393
490
|
* @param {Mixed} value
|
|
394
491
|
* @param {String} message
|
|
492
|
+
* @namespace Assert
|
|
395
493
|
* @api public
|
|
396
494
|
*/
|
|
397
495
|
|
|
@@ -410,6 +508,7 @@ module.exports = function (chai, util) {
|
|
|
410
508
|
* @name isFunction
|
|
411
509
|
* @param {Mixed} value
|
|
412
510
|
* @param {String} message
|
|
511
|
+
* @namespace Assert
|
|
413
512
|
* @api public
|
|
414
513
|
*/
|
|
415
514
|
|
|
@@ -428,6 +527,7 @@ module.exports = function (chai, util) {
|
|
|
428
527
|
* @name isNotFunction
|
|
429
528
|
* @param {Mixed} value
|
|
430
529
|
* @param {String} message
|
|
530
|
+
* @namespace Assert
|
|
431
531
|
* @api public
|
|
432
532
|
*/
|
|
433
533
|
|
|
@@ -438,8 +538,8 @@ module.exports = function (chai, util) {
|
|
|
438
538
|
/**
|
|
439
539
|
* ### .isObject(value, [message])
|
|
440
540
|
*
|
|
441
|
-
* Asserts that `value` is an object (as revealed by
|
|
442
|
-
*
|
|
541
|
+
* Asserts that `value` is an object of type 'Object' (as revealed by `Object.prototype.toString`).
|
|
542
|
+
* _The assertion does not match subclassed objects._
|
|
443
543
|
*
|
|
444
544
|
* var selection = { name: 'Chai', serve: 'with spices' };
|
|
445
545
|
* assert.isObject(selection, 'tea selection is an object');
|
|
@@ -447,6 +547,7 @@ module.exports = function (chai, util) {
|
|
|
447
547
|
* @name isObject
|
|
448
548
|
* @param {Mixed} value
|
|
449
549
|
* @param {String} message
|
|
550
|
+
* @namespace Assert
|
|
450
551
|
* @api public
|
|
451
552
|
*/
|
|
452
553
|
|
|
@@ -457,7 +558,7 @@ module.exports = function (chai, util) {
|
|
|
457
558
|
/**
|
|
458
559
|
* ### .isNotObject(value, [message])
|
|
459
560
|
*
|
|
460
|
-
* Asserts that `value` is _not_ an object.
|
|
561
|
+
* Asserts that `value` is _not_ an object of type 'Object' (as revealed by `Object.prototype.toString`).
|
|
461
562
|
*
|
|
462
563
|
* var selection = 'chai'
|
|
463
564
|
* assert.isNotObject(selection, 'tea selection is not an object');
|
|
@@ -466,6 +567,7 @@ module.exports = function (chai, util) {
|
|
|
466
567
|
* @name isNotObject
|
|
467
568
|
* @param {Mixed} value
|
|
468
569
|
* @param {String} message
|
|
570
|
+
* @namespace Assert
|
|
469
571
|
* @api public
|
|
470
572
|
*/
|
|
471
573
|
|
|
@@ -484,6 +586,7 @@ module.exports = function (chai, util) {
|
|
|
484
586
|
* @name isArray
|
|
485
587
|
* @param {Mixed} value
|
|
486
588
|
* @param {String} message
|
|
589
|
+
* @namespace Assert
|
|
487
590
|
* @api public
|
|
488
591
|
*/
|
|
489
592
|
|
|
@@ -502,6 +605,7 @@ module.exports = function (chai, util) {
|
|
|
502
605
|
* @name isNotArray
|
|
503
606
|
* @param {Mixed} value
|
|
504
607
|
* @param {String} message
|
|
608
|
+
* @namespace Assert
|
|
505
609
|
* @api public
|
|
506
610
|
*/
|
|
507
611
|
|
|
@@ -520,6 +624,7 @@ module.exports = function (chai, util) {
|
|
|
520
624
|
* @name isString
|
|
521
625
|
* @param {Mixed} value
|
|
522
626
|
* @param {String} message
|
|
627
|
+
* @namespace Assert
|
|
523
628
|
* @api public
|
|
524
629
|
*/
|
|
525
630
|
|
|
@@ -538,6 +643,7 @@ module.exports = function (chai, util) {
|
|
|
538
643
|
* @name isNotString
|
|
539
644
|
* @param {Mixed} value
|
|
540
645
|
* @param {String} message
|
|
646
|
+
* @namespace Assert
|
|
541
647
|
* @api public
|
|
542
648
|
*/
|
|
543
649
|
|
|
@@ -556,6 +662,7 @@ module.exports = function (chai, util) {
|
|
|
556
662
|
* @name isNumber
|
|
557
663
|
* @param {Number} value
|
|
558
664
|
* @param {String} message
|
|
665
|
+
* @namespace Assert
|
|
559
666
|
* @api public
|
|
560
667
|
*/
|
|
561
668
|
|
|
@@ -574,6 +681,7 @@ module.exports = function (chai, util) {
|
|
|
574
681
|
* @name isNotNumber
|
|
575
682
|
* @param {Mixed} value
|
|
576
683
|
* @param {String} message
|
|
684
|
+
* @namespace Assert
|
|
577
685
|
* @api public
|
|
578
686
|
*/
|
|
579
687
|
|
|
@@ -595,6 +703,7 @@ module.exports = function (chai, util) {
|
|
|
595
703
|
* @name isBoolean
|
|
596
704
|
* @param {Mixed} value
|
|
597
705
|
* @param {String} message
|
|
706
|
+
* @namespace Assert
|
|
598
707
|
* @api public
|
|
599
708
|
*/
|
|
600
709
|
|
|
@@ -616,6 +725,7 @@ module.exports = function (chai, util) {
|
|
|
616
725
|
* @name isNotBoolean
|
|
617
726
|
* @param {Mixed} value
|
|
618
727
|
* @param {String} message
|
|
728
|
+
* @namespace Assert
|
|
619
729
|
* @api public
|
|
620
730
|
*/
|
|
621
731
|
|
|
@@ -640,6 +750,7 @@ module.exports = function (chai, util) {
|
|
|
640
750
|
* @param {Mixed} value
|
|
641
751
|
* @param {String} name
|
|
642
752
|
* @param {String} message
|
|
753
|
+
* @namespace Assert
|
|
643
754
|
* @api public
|
|
644
755
|
*/
|
|
645
756
|
|
|
@@ -659,6 +770,7 @@ module.exports = function (chai, util) {
|
|
|
659
770
|
* @param {Mixed} value
|
|
660
771
|
* @param {String} typeof name
|
|
661
772
|
* @param {String} message
|
|
773
|
+
* @namespace Assert
|
|
662
774
|
* @api public
|
|
663
775
|
*/
|
|
664
776
|
|
|
@@ -680,6 +792,7 @@ module.exports = function (chai, util) {
|
|
|
680
792
|
* @param {Object} object
|
|
681
793
|
* @param {Constructor} constructor
|
|
682
794
|
* @param {String} message
|
|
795
|
+
* @namespace Assert
|
|
683
796
|
* @api public
|
|
684
797
|
*/
|
|
685
798
|
|
|
@@ -701,6 +814,7 @@ module.exports = function (chai, util) {
|
|
|
701
814
|
* @param {Object} object
|
|
702
815
|
* @param {Constructor} constructor
|
|
703
816
|
* @param {String} message
|
|
817
|
+
* @namespace Assert
|
|
704
818
|
* @api public
|
|
705
819
|
*/
|
|
706
820
|
|
|
@@ -721,6 +835,7 @@ module.exports = function (chai, util) {
|
|
|
721
835
|
* @param {Array|String} haystack
|
|
722
836
|
* @param {Mixed} needle
|
|
723
837
|
* @param {String} message
|
|
838
|
+
* @namespace Assert
|
|
724
839
|
* @api public
|
|
725
840
|
*/
|
|
726
841
|
|
|
@@ -741,6 +856,7 @@ module.exports = function (chai, util) {
|
|
|
741
856
|
* @param {Array|String} haystack
|
|
742
857
|
* @param {Mixed} needle
|
|
743
858
|
* @param {String} message
|
|
859
|
+
* @namespace Assert
|
|
744
860
|
* @api public
|
|
745
861
|
*/
|
|
746
862
|
|
|
@@ -759,6 +875,7 @@ module.exports = function (chai, util) {
|
|
|
759
875
|
* @param {Mixed} value
|
|
760
876
|
* @param {RegExp} regexp
|
|
761
877
|
* @param {String} message
|
|
878
|
+
* @namespace Assert
|
|
762
879
|
* @api public
|
|
763
880
|
*/
|
|
764
881
|
|
|
@@ -777,6 +894,7 @@ module.exports = function (chai, util) {
|
|
|
777
894
|
* @param {Mixed} value
|
|
778
895
|
* @param {RegExp} regexp
|
|
779
896
|
* @param {String} message
|
|
897
|
+
* @namespace Assert
|
|
780
898
|
* @api public
|
|
781
899
|
*/
|
|
782
900
|
|
|
@@ -795,6 +913,7 @@ module.exports = function (chai, util) {
|
|
|
795
913
|
* @param {Object} object
|
|
796
914
|
* @param {String} property
|
|
797
915
|
* @param {String} message
|
|
916
|
+
* @namespace Assert
|
|
798
917
|
* @api public
|
|
799
918
|
*/
|
|
800
919
|
|
|
@@ -813,6 +932,7 @@ module.exports = function (chai, util) {
|
|
|
813
932
|
* @param {Object} object
|
|
814
933
|
* @param {String} property
|
|
815
934
|
* @param {String} message
|
|
935
|
+
* @namespace Assert
|
|
816
936
|
* @api public
|
|
817
937
|
*/
|
|
818
938
|
|
|
@@ -832,6 +952,7 @@ module.exports = function (chai, util) {
|
|
|
832
952
|
* @param {Object} object
|
|
833
953
|
* @param {String} property
|
|
834
954
|
* @param {String} message
|
|
955
|
+
* @namespace Assert
|
|
835
956
|
* @api public
|
|
836
957
|
*/
|
|
837
958
|
|
|
@@ -851,6 +972,7 @@ module.exports = function (chai, util) {
|
|
|
851
972
|
* @param {Object} object
|
|
852
973
|
* @param {String} property
|
|
853
974
|
* @param {String} message
|
|
975
|
+
* @namespace Assert
|
|
854
976
|
* @api public
|
|
855
977
|
*/
|
|
856
978
|
|
|
@@ -871,6 +993,7 @@ module.exports = function (chai, util) {
|
|
|
871
993
|
* @param {String} property
|
|
872
994
|
* @param {Mixed} value
|
|
873
995
|
* @param {String} message
|
|
996
|
+
* @namespace Assert
|
|
874
997
|
* @api public
|
|
875
998
|
*/
|
|
876
999
|
|
|
@@ -891,6 +1014,7 @@ module.exports = function (chai, util) {
|
|
|
891
1014
|
* @param {String} property
|
|
892
1015
|
* @param {Mixed} value
|
|
893
1016
|
* @param {String} message
|
|
1017
|
+
* @namespace Assert
|
|
894
1018
|
* @api public
|
|
895
1019
|
*/
|
|
896
1020
|
|
|
@@ -912,6 +1036,7 @@ module.exports = function (chai, util) {
|
|
|
912
1036
|
* @param {String} property
|
|
913
1037
|
* @param {Mixed} value
|
|
914
1038
|
* @param {String} message
|
|
1039
|
+
* @namespace Assert
|
|
915
1040
|
* @api public
|
|
916
1041
|
*/
|
|
917
1042
|
|
|
@@ -933,6 +1058,7 @@ module.exports = function (chai, util) {
|
|
|
933
1058
|
* @param {String} property
|
|
934
1059
|
* @param {Mixed} value
|
|
935
1060
|
* @param {String} message
|
|
1061
|
+
* @namespace Assert
|
|
936
1062
|
* @api public
|
|
937
1063
|
*/
|
|
938
1064
|
|
|
@@ -946,12 +1072,13 @@ module.exports = function (chai, util) {
|
|
|
946
1072
|
* Asserts that `object` has a `length` property with the expected value.
|
|
947
1073
|
*
|
|
948
1074
|
* assert.lengthOf([1,2,3], 3, 'array has length of 3');
|
|
949
|
-
* assert.lengthOf('foobar',
|
|
1075
|
+
* assert.lengthOf('foobar', 6, 'string has length of 6');
|
|
950
1076
|
*
|
|
951
1077
|
* @name lengthOf
|
|
952
1078
|
* @param {Mixed} object
|
|
953
1079
|
* @param {Number} length
|
|
954
1080
|
* @param {String} message
|
|
1081
|
+
* @namespace Assert
|
|
955
1082
|
* @api public
|
|
956
1083
|
*/
|
|
957
1084
|
|
|
@@ -980,6 +1107,7 @@ module.exports = function (chai, util) {
|
|
|
980
1107
|
* @param {RegExp} regexp
|
|
981
1108
|
* @param {String} message
|
|
982
1109
|
* @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
|
|
1110
|
+
* @namespace Assert
|
|
983
1111
|
* @api public
|
|
984
1112
|
*/
|
|
985
1113
|
|
|
@@ -1008,6 +1136,7 @@ module.exports = function (chai, util) {
|
|
|
1008
1136
|
* @param {RegExp} regexp
|
|
1009
1137
|
* @param {String} message
|
|
1010
1138
|
* @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
|
|
1139
|
+
* @namespace Assert
|
|
1011
1140
|
* @api public
|
|
1012
1141
|
*/
|
|
1013
1142
|
|
|
@@ -1033,6 +1162,7 @@ module.exports = function (chai, util) {
|
|
|
1033
1162
|
* @param {String} operator
|
|
1034
1163
|
* @param {Mixed} val2
|
|
1035
1164
|
* @param {String} message
|
|
1165
|
+
* @namespace Assert
|
|
1036
1166
|
* @api public
|
|
1037
1167
|
*/
|
|
1038
1168
|
|
|
@@ -1085,6 +1215,7 @@ module.exports = function (chai, util) {
|
|
|
1085
1215
|
* @param {Number} expected
|
|
1086
1216
|
* @param {Number} delta
|
|
1087
1217
|
* @param {String} message
|
|
1218
|
+
* @namespace Assert
|
|
1088
1219
|
* @api public
|
|
1089
1220
|
*/
|
|
1090
1221
|
|
|
@@ -1092,6 +1223,26 @@ module.exports = function (chai, util) {
|
|
|
1092
1223
|
new Assertion(act, msg).to.be.closeTo(exp, delta);
|
|
1093
1224
|
};
|
|
1094
1225
|
|
|
1226
|
+
/**
|
|
1227
|
+
* ### .approximately(actual, expected, delta, [message])
|
|
1228
|
+
*
|
|
1229
|
+
* Asserts that the target is equal `expected`, to within a +/- `delta` range.
|
|
1230
|
+
*
|
|
1231
|
+
* assert.approximately(1.5, 1, 0.5, 'numbers are close');
|
|
1232
|
+
*
|
|
1233
|
+
* @name approximately
|
|
1234
|
+
* @param {Number} actual
|
|
1235
|
+
* @param {Number} expected
|
|
1236
|
+
* @param {Number} delta
|
|
1237
|
+
* @param {String} message
|
|
1238
|
+
* @namespace Assert
|
|
1239
|
+
* @api public
|
|
1240
|
+
*/
|
|
1241
|
+
|
|
1242
|
+
assert.approximately = function (act, exp, delta, msg) {
|
|
1243
|
+
new Assertion(act, msg).to.be.approximately(exp, delta);
|
|
1244
|
+
};
|
|
1245
|
+
|
|
1095
1246
|
/**
|
|
1096
1247
|
* ### .sameMembers(set1, set2, [message])
|
|
1097
1248
|
*
|
|
@@ -1104,6 +1255,7 @@ module.exports = function (chai, util) {
|
|
|
1104
1255
|
* @param {Array} set1
|
|
1105
1256
|
* @param {Array} set2
|
|
1106
1257
|
* @param {String} message
|
|
1258
|
+
* @namespace Assert
|
|
1107
1259
|
* @api public
|
|
1108
1260
|
*/
|
|
1109
1261
|
|
|
@@ -1123,6 +1275,7 @@ module.exports = function (chai, util) {
|
|
|
1123
1275
|
* @param {Array} set1
|
|
1124
1276
|
* @param {Array} set2
|
|
1125
1277
|
* @param {String} message
|
|
1278
|
+
* @namespace Assert
|
|
1126
1279
|
* @api public
|
|
1127
1280
|
*/
|
|
1128
1281
|
|
|
@@ -1142,6 +1295,7 @@ module.exports = function (chai, util) {
|
|
|
1142
1295
|
* @param {Array} superset
|
|
1143
1296
|
* @param {Array} subset
|
|
1144
1297
|
* @param {String} message
|
|
1298
|
+
* @namespace Assert
|
|
1145
1299
|
* @api public
|
|
1146
1300
|
*/
|
|
1147
1301
|
|
|
@@ -1149,6 +1303,46 @@ module.exports = function (chai, util) {
|
|
|
1149
1303
|
new Assertion(superset, msg).to.include.members(subset);
|
|
1150
1304
|
}
|
|
1151
1305
|
|
|
1306
|
+
/**
|
|
1307
|
+
* ### .includeDeepMembers(superset, subset, [message])
|
|
1308
|
+
*
|
|
1309
|
+
* Asserts that `subset` is included in `superset` - using deep equality checking.
|
|
1310
|
+
* Order is not taken into account.
|
|
1311
|
+
* Duplicates are ignored.
|
|
1312
|
+
*
|
|
1313
|
+
* assert.includeDeepMembers([ {a: 1}, {b: 2}, {c: 3} ], [ {b: 2}, {a: 1}, {b: 2} ], 'include deep members');
|
|
1314
|
+
*
|
|
1315
|
+
* @name includeDeepMembers
|
|
1316
|
+
* @param {Array} superset
|
|
1317
|
+
* @param {Array} subset
|
|
1318
|
+
* @param {String} message
|
|
1319
|
+
* @namespace Assert
|
|
1320
|
+
* @api public
|
|
1321
|
+
*/
|
|
1322
|
+
|
|
1323
|
+
assert.includeDeepMembers = function (superset, subset, msg) {
|
|
1324
|
+
new Assertion(superset, msg).to.include.deep.members(subset);
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
/**
|
|
1328
|
+
* ### .oneOf(inList, list, [message])
|
|
1329
|
+
*
|
|
1330
|
+
* Asserts that non-object, non-array value `inList` appears in the flat array `list`.
|
|
1331
|
+
*
|
|
1332
|
+
* assert.oneOf(1, [ 2, 1 ], 'Not found in list');
|
|
1333
|
+
*
|
|
1334
|
+
* @name oneOf
|
|
1335
|
+
* @param {*} inList
|
|
1336
|
+
* @param {Array<*>} list
|
|
1337
|
+
* @param {String} message
|
|
1338
|
+
* @namespace Assert
|
|
1339
|
+
* @api public
|
|
1340
|
+
*/
|
|
1341
|
+
|
|
1342
|
+
assert.oneOf = function (inList, list, msg) {
|
|
1343
|
+
new Assertion(inList, msg).to.be.oneOf(list);
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1152
1346
|
/**
|
|
1153
1347
|
* ### .changes(function, object, property)
|
|
1154
1348
|
*
|
|
@@ -1163,6 +1357,7 @@ module.exports = function (chai, util) {
|
|
|
1163
1357
|
* @param {Object} object
|
|
1164
1358
|
* @param {String} property name
|
|
1165
1359
|
* @param {String} message _optional_
|
|
1360
|
+
* @namespace Assert
|
|
1166
1361
|
* @api public
|
|
1167
1362
|
*/
|
|
1168
1363
|
|
|
@@ -1184,6 +1379,7 @@ module.exports = function (chai, util) {
|
|
|
1184
1379
|
* @param {Object} object
|
|
1185
1380
|
* @param {String} property name
|
|
1186
1381
|
* @param {String} message _optional_
|
|
1382
|
+
* @namespace Assert
|
|
1187
1383
|
* @api public
|
|
1188
1384
|
*/
|
|
1189
1385
|
|
|
@@ -1205,6 +1401,7 @@ module.exports = function (chai, util) {
|
|
|
1205
1401
|
* @param {Object} object
|
|
1206
1402
|
* @param {String} property name
|
|
1207
1403
|
* @param {String} message _optional_
|
|
1404
|
+
* @namespace Assert
|
|
1208
1405
|
* @api public
|
|
1209
1406
|
*/
|
|
1210
1407
|
|
|
@@ -1226,6 +1423,7 @@ module.exports = function (chai, util) {
|
|
|
1226
1423
|
* @param {Object} object
|
|
1227
1424
|
* @param {String} property name
|
|
1228
1425
|
* @param {String} message _optional_
|
|
1426
|
+
* @namespace Assert
|
|
1229
1427
|
* @api public
|
|
1230
1428
|
*/
|
|
1231
1429
|
|
|
@@ -1247,6 +1445,7 @@ module.exports = function (chai, util) {
|
|
|
1247
1445
|
* @param {Object} object
|
|
1248
1446
|
* @param {String} property name
|
|
1249
1447
|
* @param {String} message _optional_
|
|
1448
|
+
* @namespace Assert
|
|
1250
1449
|
* @api public
|
|
1251
1450
|
*/
|
|
1252
1451
|
|
|
@@ -1268,6 +1467,7 @@ module.exports = function (chai, util) {
|
|
|
1268
1467
|
* @param {Object} object
|
|
1269
1468
|
* @param {String} property name
|
|
1270
1469
|
* @param {String} message _optional_
|
|
1470
|
+
* @namespace Assert
|
|
1271
1471
|
* @api public
|
|
1272
1472
|
*/
|
|
1273
1473
|
|
|
@@ -1287,6 +1487,7 @@ module.exports = function (chai, util) {
|
|
|
1287
1487
|
*
|
|
1288
1488
|
* @name ifError
|
|
1289
1489
|
* @param {Object} object
|
|
1490
|
+
* @namespace Assert
|
|
1290
1491
|
* @api public
|
|
1291
1492
|
*/
|
|
1292
1493
|
|
|
@@ -1307,6 +1508,7 @@ module.exports = function (chai, util) {
|
|
|
1307
1508
|
* @alias extensible
|
|
1308
1509
|
* @param {Object} object
|
|
1309
1510
|
* @param {String} message _optional_
|
|
1511
|
+
* @namespace Assert
|
|
1310
1512
|
* @api public
|
|
1311
1513
|
*/
|
|
1312
1514
|
|
|
@@ -1331,6 +1533,7 @@ module.exports = function (chai, util) {
|
|
|
1331
1533
|
* @alias notExtensible
|
|
1332
1534
|
* @param {Object} object
|
|
1333
1535
|
* @param {String} message _optional_
|
|
1536
|
+
* @namespace Assert
|
|
1334
1537
|
* @api public
|
|
1335
1538
|
*/
|
|
1336
1539
|
|
|
@@ -1354,6 +1557,7 @@ module.exports = function (chai, util) {
|
|
|
1354
1557
|
* @alias sealed
|
|
1355
1558
|
* @param {Object} object
|
|
1356
1559
|
* @param {String} message _optional_
|
|
1560
|
+
* @namespace Assert
|
|
1357
1561
|
* @api public
|
|
1358
1562
|
*/
|
|
1359
1563
|
|
|
@@ -1372,6 +1576,7 @@ module.exports = function (chai, util) {
|
|
|
1372
1576
|
* @alias notSealed
|
|
1373
1577
|
* @param {Object} object
|
|
1374
1578
|
* @param {String} message _optional_
|
|
1579
|
+
* @namespace Assert
|
|
1375
1580
|
* @api public
|
|
1376
1581
|
*/
|
|
1377
1582
|
|
|
@@ -1392,6 +1597,7 @@ module.exports = function (chai, util) {
|
|
|
1392
1597
|
* @alias frozen
|
|
1393
1598
|
* @param {Object} object
|
|
1394
1599
|
* @param {String} message _optional_
|
|
1600
|
+
* @namespace Assert
|
|
1395
1601
|
* @api public
|
|
1396
1602
|
*/
|
|
1397
1603
|
|
|
@@ -1410,6 +1616,7 @@ module.exports = function (chai, util) {
|
|
|
1410
1616
|
* @alias notFrozen
|
|
1411
1617
|
* @param {Object} object
|
|
1412
1618
|
* @param {String} message _optional_
|
|
1619
|
+
* @namespace Assert
|
|
1413
1620
|
* @api public
|
|
1414
1621
|
*/
|
|
1415
1622
|
|