chai 5.0.3 → 5.1.1
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/README.md +3 -3
- package/chai.js +94 -220
- package/eslint.config.js +12 -0
- package/lib/chai/assertion.js +30 -31
- package/lib/chai/config.js +18 -24
- package/lib/chai/core/assertions.js +253 -223
- package/lib/chai/interface/assert.js +574 -670
- package/lib/chai/interface/expect.js +12 -7
- package/lib/chai/interface/should.js +43 -40
- package/lib/chai/utils/addChainableMethod.js +6 -11
- package/lib/chai/utils/addLengthGuard.js +3 -3
- package/lib/chai/utils/addMethod.js +5 -6
- package/lib/chai/utils/addProperty.js +5 -6
- package/lib/chai/utils/compareByInspect.js +4 -9
- package/lib/chai/utils/expectTypes.js +7 -8
- package/lib/chai/utils/flag.js +5 -5
- package/lib/chai/utils/getActual.js +3 -3
- package/lib/chai/utils/getEnumerableProperties.js +2 -3
- package/lib/chai/utils/getMessage.js +4 -8
- package/lib/chai/utils/getOperator.js +8 -4
- package/lib/chai/utils/getOwnEnumerableProperties.js +2 -7
- package/lib/chai/utils/getOwnEnumerablePropertySymbols.js +2 -3
- package/lib/chai/utils/getProperties.js +5 -3
- package/lib/chai/utils/index.js +42 -109
- package/lib/chai/utils/inspect.js +5 -4
- package/lib/chai/utils/isNaN.js +3 -3
- package/lib/chai/utils/isProxyEnabled.js +1 -1
- package/lib/chai/utils/objDisplay.js +2 -7
- package/lib/chai/utils/overwriteChainableMethod.js +7 -8
- package/lib/chai/utils/overwriteMethod.js +10 -11
- package/lib/chai/utils/overwriteProperty.js +10 -12
- package/lib/chai/utils/proxify.js +9 -9
- package/lib/chai/utils/test.js +3 -7
- package/lib/chai/utils/transferFlags.js +4 -6
- package/lib/chai/utils/type-detect.js +4 -0
- package/lib/chai.js +9 -31
- package/package.json +6 -3
- package/web-test-runner.config.js +4 -1
|
@@ -8,7 +8,6 @@ import * as chai from '../../../index.js';
|
|
|
8
8
|
import {Assertion} from '../assertion.js';
|
|
9
9
|
import {flag, inspect} from '../utils/index.js';
|
|
10
10
|
import {AssertionError} from 'assertion-error';
|
|
11
|
-
import {type} from '../utils/type-detect.js';
|
|
12
11
|
|
|
13
12
|
/**
|
|
14
13
|
* ### assert(expression, message)
|
|
@@ -18,14 +17,13 @@ import {type} from '../utils/type-detect.js';
|
|
|
18
17
|
* assert('foo' !== 'bar', 'foo is not bar');
|
|
19
18
|
* assert(Array.isArray([]), 'empty arrays are arrays');
|
|
20
19
|
*
|
|
21
|
-
* @param {
|
|
22
|
-
* @param {
|
|
20
|
+
* @param {unknown} express - expression to test for truthiness
|
|
21
|
+
* @param {string} errmsg - message to display on error
|
|
23
22
|
* @name assert
|
|
24
23
|
* @namespace Assert
|
|
25
|
-
* @
|
|
24
|
+
* @public
|
|
26
25
|
*/
|
|
27
|
-
|
|
28
|
-
function assert(express, errmsg) {
|
|
26
|
+
export function assert(express, errmsg) {
|
|
29
27
|
var test = new Assertion(null, null, chai.assert, true);
|
|
30
28
|
test.assert(
|
|
31
29
|
express
|
|
@@ -34,8 +32,6 @@ function assert(express, errmsg) {
|
|
|
34
32
|
);
|
|
35
33
|
}
|
|
36
34
|
|
|
37
|
-
export {assert};
|
|
38
|
-
|
|
39
35
|
/**
|
|
40
36
|
* ### .fail([message])
|
|
41
37
|
* ### .fail(actual, expected, [message], [operator])
|
|
@@ -50,14 +46,13 @@ export {assert};
|
|
|
50
46
|
* assert.fail(1, 2, undefined, ">");
|
|
51
47
|
*
|
|
52
48
|
* @name fail
|
|
53
|
-
* @param {
|
|
54
|
-
* @param {
|
|
55
|
-
* @param {
|
|
56
|
-
* @param {
|
|
49
|
+
* @param {unknown} actual
|
|
50
|
+
* @param {unknown} expected
|
|
51
|
+
* @param {string} message
|
|
52
|
+
* @param {string} operator
|
|
57
53
|
* @namespace Assert
|
|
58
|
-
* @
|
|
54
|
+
* @public
|
|
59
55
|
*/
|
|
60
|
-
|
|
61
56
|
assert.fail = function (actual, expected, message, operator) {
|
|
62
57
|
if (arguments.length < 2) {
|
|
63
58
|
// Comply with Node's fail([message]) interface
|
|
@@ -84,12 +79,11 @@ assert.fail = function (actual, expected, message, operator) {
|
|
|
84
79
|
*
|
|
85
80
|
* @name isOk
|
|
86
81
|
* @alias ok
|
|
87
|
-
* @param {
|
|
88
|
-
* @param {
|
|
82
|
+
* @param {unknown} val object to test
|
|
83
|
+
* @param {string} msg
|
|
89
84
|
* @namespace Assert
|
|
90
|
-
* @
|
|
85
|
+
* @public
|
|
91
86
|
*/
|
|
92
|
-
|
|
93
87
|
assert.isOk = function (val, msg) {
|
|
94
88
|
new Assertion(val, msg, assert.isOk, true).is.ok;
|
|
95
89
|
};
|
|
@@ -104,12 +98,11 @@ assert.isOk = function (val, msg) {
|
|
|
104
98
|
*
|
|
105
99
|
* @name isNotOk
|
|
106
100
|
* @alias notOk
|
|
107
|
-
* @param {
|
|
108
|
-
* @param {
|
|
101
|
+
* @param {unknown} val object to test
|
|
102
|
+
* @param {string} msg
|
|
109
103
|
* @namespace Assert
|
|
110
|
-
* @
|
|
104
|
+
* @public
|
|
111
105
|
*/
|
|
112
|
-
|
|
113
106
|
assert.isNotOk = function (val, msg) {
|
|
114
107
|
new Assertion(val, msg, assert.isNotOk, true).is.not.ok;
|
|
115
108
|
};
|
|
@@ -122,13 +115,12 @@ assert.isNotOk = function (val, msg) {
|
|
|
122
115
|
* assert.equal(3, '3', '== coerces values to strings');
|
|
123
116
|
*
|
|
124
117
|
* @name equal
|
|
125
|
-
* @param {
|
|
126
|
-
* @param {
|
|
127
|
-
* @param {
|
|
118
|
+
* @param {unknown} act
|
|
119
|
+
* @param {unknown} exp
|
|
120
|
+
* @param {string} msg
|
|
128
121
|
* @namespace Assert
|
|
129
|
-
* @
|
|
122
|
+
* @public
|
|
130
123
|
*/
|
|
131
|
-
|
|
132
124
|
assert.equal = function (act, exp, msg) {
|
|
133
125
|
var test = new Assertion(act, msg, assert.equal, true);
|
|
134
126
|
|
|
@@ -150,13 +142,12 @@ assert.equal = function (act, exp, msg) {
|
|
|
150
142
|
* assert.notEqual(3, 4, 'these numbers are not equal');
|
|
151
143
|
*
|
|
152
144
|
* @name notEqual
|
|
153
|
-
* @param {
|
|
154
|
-
* @param {
|
|
155
|
-
* @param {
|
|
145
|
+
* @param {unknown} act
|
|
146
|
+
* @param {unknown} exp
|
|
147
|
+
* @param {string} msg
|
|
156
148
|
* @namespace Assert
|
|
157
|
-
* @
|
|
149
|
+
* @public
|
|
158
150
|
*/
|
|
159
|
-
|
|
160
151
|
assert.notEqual = function (act, exp, msg) {
|
|
161
152
|
var test = new Assertion(act, msg, assert.notEqual, true);
|
|
162
153
|
|
|
@@ -178,13 +169,12 @@ assert.notEqual = function (act, exp, msg) {
|
|
|
178
169
|
* assert.strictEqual(true, true, 'these booleans are strictly equal');
|
|
179
170
|
*
|
|
180
171
|
* @name strictEqual
|
|
181
|
-
* @param {
|
|
182
|
-
* @param {
|
|
183
|
-
* @param {
|
|
172
|
+
* @param {unknown} act
|
|
173
|
+
* @param {unknown} exp
|
|
174
|
+
* @param {string} msg
|
|
184
175
|
* @namespace Assert
|
|
185
|
-
* @
|
|
176
|
+
* @public
|
|
186
177
|
*/
|
|
187
|
-
|
|
188
178
|
assert.strictEqual = function (act, exp, msg) {
|
|
189
179
|
new Assertion(act, msg, assert.strictEqual, true).to.equal(exp);
|
|
190
180
|
};
|
|
@@ -197,13 +187,12 @@ assert.strictEqual = function (act, exp, msg) {
|
|
|
197
187
|
* assert.notStrictEqual(3, '3', 'no coercion for strict equality');
|
|
198
188
|
*
|
|
199
189
|
* @name notStrictEqual
|
|
200
|
-
* @param {
|
|
201
|
-
* @param {
|
|
202
|
-
* @param {
|
|
190
|
+
* @param {unknown} act
|
|
191
|
+
* @param {unknown} exp
|
|
192
|
+
* @param {string} msg
|
|
203
193
|
* @namespace Assert
|
|
204
|
-
* @
|
|
194
|
+
* @public
|
|
205
195
|
*/
|
|
206
|
-
|
|
207
196
|
assert.notStrictEqual = function (act, exp, msg) {
|
|
208
197
|
new Assertion(act, msg, assert.notStrictEqual, true).to.not.equal(exp);
|
|
209
198
|
};
|
|
@@ -216,14 +205,13 @@ assert.notStrictEqual = function (act, exp, msg) {
|
|
|
216
205
|
* assert.deepEqual({ tea: 'green' }, { tea: 'green' });
|
|
217
206
|
*
|
|
218
207
|
* @name deepEqual
|
|
219
|
-
* @param {
|
|
220
|
-
* @param {
|
|
221
|
-
* @param {
|
|
208
|
+
* @param {unknown} act
|
|
209
|
+
* @param {unknown} exp
|
|
210
|
+
* @param {string} msg
|
|
222
211
|
* @alias deepStrictEqual
|
|
223
212
|
* @namespace Assert
|
|
224
|
-
* @
|
|
213
|
+
* @public
|
|
225
214
|
*/
|
|
226
|
-
|
|
227
215
|
assert.deepEqual = assert.deepStrictEqual = function (act, exp, msg) {
|
|
228
216
|
new Assertion(act, msg, assert.deepEqual, true).to.eql(exp);
|
|
229
217
|
};
|
|
@@ -236,18 +224,17 @@ assert.deepEqual = assert.deepStrictEqual = function (act, exp, msg) {
|
|
|
236
224
|
* assert.notDeepEqual({ tea: 'green' }, { tea: 'jasmine' });
|
|
237
225
|
*
|
|
238
226
|
* @name notDeepEqual
|
|
239
|
-
* @param {
|
|
240
|
-
* @param {
|
|
241
|
-
* @param {
|
|
227
|
+
* @param {unknown} act
|
|
228
|
+
* @param {unknown} exp
|
|
229
|
+
* @param {string} msg
|
|
242
230
|
* @namespace Assert
|
|
243
|
-
* @
|
|
231
|
+
* @public
|
|
244
232
|
*/
|
|
245
|
-
|
|
246
233
|
assert.notDeepEqual = function (act, exp, msg) {
|
|
247
234
|
new Assertion(act, msg, assert.notDeepEqual, true).to.not.eql(exp);
|
|
248
235
|
};
|
|
249
236
|
|
|
250
|
-
|
|
237
|
+
/**
|
|
251
238
|
* ### .isAbove(valueToCheck, valueToBeAbove, [message])
|
|
252
239
|
*
|
|
253
240
|
* Asserts `valueToCheck` is strictly greater than (>) `valueToBeAbove`.
|
|
@@ -255,18 +242,17 @@ assert.notDeepEqual = function (act, exp, msg) {
|
|
|
255
242
|
* assert.isAbove(5, 2, '5 is strictly greater than 2');
|
|
256
243
|
*
|
|
257
244
|
* @name isAbove
|
|
258
|
-
* @param {
|
|
259
|
-
* @param {
|
|
260
|
-
* @param {
|
|
245
|
+
* @param {unknown} val
|
|
246
|
+
* @param {unknown} abv
|
|
247
|
+
* @param {string} msg
|
|
261
248
|
* @namespace Assert
|
|
262
|
-
* @
|
|
249
|
+
* @public
|
|
263
250
|
*/
|
|
264
|
-
|
|
265
251
|
assert.isAbove = function (val, abv, msg) {
|
|
266
252
|
new Assertion(val, msg, assert.isAbove, true).to.be.above(abv);
|
|
267
253
|
};
|
|
268
254
|
|
|
269
|
-
|
|
255
|
+
/**
|
|
270
256
|
* ### .isAtLeast(valueToCheck, valueToBeAtLeast, [message])
|
|
271
257
|
*
|
|
272
258
|
* Asserts `valueToCheck` is greater than or equal to (>=) `valueToBeAtLeast`.
|
|
@@ -275,18 +261,17 @@ assert.isAbove = function (val, abv, msg) {
|
|
|
275
261
|
* assert.isAtLeast(3, 3, '3 is greater or equal to 3');
|
|
276
262
|
*
|
|
277
263
|
* @name isAtLeast
|
|
278
|
-
* @param {
|
|
279
|
-
* @param {
|
|
280
|
-
* @param {
|
|
264
|
+
* @param {unknown} val
|
|
265
|
+
* @param {unknown} atlst
|
|
266
|
+
* @param {string} msg
|
|
281
267
|
* @namespace Assert
|
|
282
|
-
* @
|
|
268
|
+
* @public
|
|
283
269
|
*/
|
|
284
|
-
|
|
285
270
|
assert.isAtLeast = function (val, atlst, msg) {
|
|
286
271
|
new Assertion(val, msg, assert.isAtLeast, true).to.be.least(atlst);
|
|
287
272
|
};
|
|
288
273
|
|
|
289
|
-
|
|
274
|
+
/**
|
|
290
275
|
* ### .isBelow(valueToCheck, valueToBeBelow, [message])
|
|
291
276
|
*
|
|
292
277
|
* Asserts `valueToCheck` is strictly less than (<) `valueToBeBelow`.
|
|
@@ -294,18 +279,17 @@ assert.isAtLeast = function (val, atlst, msg) {
|
|
|
294
279
|
* assert.isBelow(3, 6, '3 is strictly less than 6');
|
|
295
280
|
*
|
|
296
281
|
* @name isBelow
|
|
297
|
-
* @param {
|
|
298
|
-
* @param {
|
|
299
|
-
* @param {
|
|
282
|
+
* @param {unknown} val
|
|
283
|
+
* @param {unknown} blw
|
|
284
|
+
* @param {string} msg
|
|
300
285
|
* @namespace Assert
|
|
301
|
-
* @
|
|
286
|
+
* @public
|
|
302
287
|
*/
|
|
303
|
-
|
|
304
288
|
assert.isBelow = function (val, blw, msg) {
|
|
305
289
|
new Assertion(val, msg, assert.isBelow, true).to.be.below(blw);
|
|
306
290
|
};
|
|
307
291
|
|
|
308
|
-
|
|
292
|
+
/**
|
|
309
293
|
* ### .isAtMost(valueToCheck, valueToBeAtMost, [message])
|
|
310
294
|
*
|
|
311
295
|
* Asserts `valueToCheck` is less than or equal to (<=) `valueToBeAtMost`.
|
|
@@ -314,13 +298,12 @@ assert.isBelow = function (val, blw, msg) {
|
|
|
314
298
|
* assert.isAtMost(4, 4, '4 is less than or equal to 4');
|
|
315
299
|
*
|
|
316
300
|
* @name isAtMost
|
|
317
|
-
* @param {
|
|
318
|
-
* @param {
|
|
319
|
-
* @param {
|
|
301
|
+
* @param {unknown} val
|
|
302
|
+
* @param {unknown} atmst
|
|
303
|
+
* @param {string} msg
|
|
320
304
|
* @namespace Assert
|
|
321
|
-
* @
|
|
305
|
+
* @public
|
|
322
306
|
*/
|
|
323
|
-
|
|
324
307
|
assert.isAtMost = function (val, atmst, msg) {
|
|
325
308
|
new Assertion(val, msg, assert.isAtMost, true).to.be.most(atmst);
|
|
326
309
|
};
|
|
@@ -334,12 +317,11 @@ assert.isAtMost = function (val, atmst, msg) {
|
|
|
334
317
|
* assert.isTrue(teaServed, 'the tea has been served');
|
|
335
318
|
*
|
|
336
319
|
* @name isTrue
|
|
337
|
-
* @param {
|
|
338
|
-
* @param {
|
|
320
|
+
* @param {unknown} val
|
|
321
|
+
* @param {string} msg
|
|
339
322
|
* @namespace Assert
|
|
340
|
-
* @
|
|
323
|
+
* @public
|
|
341
324
|
*/
|
|
342
|
-
|
|
343
325
|
assert.isTrue = function (val, msg) {
|
|
344
326
|
new Assertion(val, msg, assert.isTrue, true).is['true'];
|
|
345
327
|
};
|
|
@@ -353,12 +335,11 @@ assert.isTrue = function (val, msg) {
|
|
|
353
335
|
* assert.isNotTrue(tea, 'great, time for tea!');
|
|
354
336
|
*
|
|
355
337
|
* @name isNotTrue
|
|
356
|
-
* @param {
|
|
357
|
-
* @param {
|
|
338
|
+
* @param {unknown} val
|
|
339
|
+
* @param {string} msg
|
|
358
340
|
* @namespace Assert
|
|
359
|
-
* @
|
|
341
|
+
* @public
|
|
360
342
|
*/
|
|
361
|
-
|
|
362
343
|
assert.isNotTrue = function (val, msg) {
|
|
363
344
|
new Assertion(val, msg, assert.isNotTrue, true).to.not.equal(true);
|
|
364
345
|
};
|
|
@@ -372,12 +353,11 @@ assert.isNotTrue = function (val, msg) {
|
|
|
372
353
|
* assert.isFalse(teaServed, 'no tea yet? hmm...');
|
|
373
354
|
*
|
|
374
355
|
* @name isFalse
|
|
375
|
-
* @param {
|
|
376
|
-
* @param {
|
|
356
|
+
* @param {unknown} val
|
|
357
|
+
* @param {string} msg
|
|
377
358
|
* @namespace Assert
|
|
378
|
-
* @
|
|
359
|
+
* @public
|
|
379
360
|
*/
|
|
380
|
-
|
|
381
361
|
assert.isFalse = function (val, msg) {
|
|
382
362
|
new Assertion(val, msg, assert.isFalse, true).is['false'];
|
|
383
363
|
};
|
|
@@ -391,12 +371,11 @@ assert.isFalse = function (val, msg) {
|
|
|
391
371
|
* assert.isNotFalse(tea, 'great, time for tea!');
|
|
392
372
|
*
|
|
393
373
|
* @name isNotFalse
|
|
394
|
-
* @param {
|
|
395
|
-
* @param {
|
|
374
|
+
* @param {unknown} val
|
|
375
|
+
* @param {string} msg
|
|
396
376
|
* @namespace Assert
|
|
397
|
-
* @
|
|
377
|
+
* @public
|
|
398
378
|
*/
|
|
399
|
-
|
|
400
379
|
assert.isNotFalse = function (val, msg) {
|
|
401
380
|
new Assertion(val, msg, assert.isNotFalse, true).to.not.equal(false);
|
|
402
381
|
};
|
|
@@ -409,12 +388,11 @@ assert.isNotFalse = function (val, msg) {
|
|
|
409
388
|
* assert.isNull(err, 'there was no error');
|
|
410
389
|
*
|
|
411
390
|
* @name isNull
|
|
412
|
-
* @param {
|
|
413
|
-
* @param {
|
|
391
|
+
* @param {unknown} val
|
|
392
|
+
* @param {string} msg
|
|
414
393
|
* @namespace Assert
|
|
415
|
-
* @
|
|
394
|
+
* @public
|
|
416
395
|
*/
|
|
417
|
-
|
|
418
396
|
assert.isNull = function (val, msg) {
|
|
419
397
|
new Assertion(val, msg, assert.isNull, true).to.equal(null);
|
|
420
398
|
};
|
|
@@ -428,12 +406,11 @@ assert.isNull = function (val, msg) {
|
|
|
428
406
|
* assert.isNotNull(tea, 'great, time for tea!');
|
|
429
407
|
*
|
|
430
408
|
* @name isNotNull
|
|
431
|
-
* @param {
|
|
432
|
-
* @param {
|
|
409
|
+
* @param {unknown} val
|
|
410
|
+
* @param {string} msg
|
|
433
411
|
* @namespace Assert
|
|
434
|
-
* @
|
|
412
|
+
* @public
|
|
435
413
|
*/
|
|
436
|
-
|
|
437
414
|
assert.isNotNull = function (val, msg) {
|
|
438
415
|
new Assertion(val, msg, assert.isNotNull, true).to.not.equal(null);
|
|
439
416
|
};
|
|
@@ -446,12 +423,11 @@ assert.isNotNull = function (val, msg) {
|
|
|
446
423
|
* assert.isNaN(NaN, 'NaN is NaN');
|
|
447
424
|
*
|
|
448
425
|
* @name isNaN
|
|
449
|
-
* @param {
|
|
450
|
-
* @param {
|
|
426
|
+
* @param {unknown} val
|
|
427
|
+
* @param {string} msg
|
|
451
428
|
* @namespace Assert
|
|
452
|
-
* @
|
|
429
|
+
* @public
|
|
453
430
|
*/
|
|
454
|
-
|
|
455
431
|
assert.isNaN = function (val, msg) {
|
|
456
432
|
new Assertion(val, msg, assert.isNaN, true).to.be.NaN;
|
|
457
433
|
};
|
|
@@ -464,13 +440,13 @@ assert.isNaN = function (val, msg) {
|
|
|
464
440
|
* assert.isNotNaN(4, '4 is not NaN');
|
|
465
441
|
*
|
|
466
442
|
* @name isNotNaN
|
|
467
|
-
* @param {
|
|
468
|
-
* @param {
|
|
443
|
+
* @param {unknown} value
|
|
444
|
+
* @param {string} message
|
|
469
445
|
* @namespace Assert
|
|
470
|
-
* @
|
|
446
|
+
* @public
|
|
471
447
|
*/
|
|
472
|
-
assert.isNotNaN = function (
|
|
473
|
-
new Assertion(
|
|
448
|
+
assert.isNotNaN = function (value, message) {
|
|
449
|
+
new Assertion(value, message, assert.isNotNaN, true).not.to.be.NaN;
|
|
474
450
|
};
|
|
475
451
|
|
|
476
452
|
/**
|
|
@@ -479,16 +455,14 @@ assert.isNotNaN = function (val, msg) {
|
|
|
479
455
|
* Asserts that the target is neither `null` nor `undefined`.
|
|
480
456
|
*
|
|
481
457
|
* var foo = 'hi';
|
|
482
|
-
*
|
|
483
458
|
* assert.exists(foo, 'foo is neither `null` nor `undefined`');
|
|
484
459
|
*
|
|
485
460
|
* @name exists
|
|
486
|
-
* @param {
|
|
487
|
-
* @param {
|
|
461
|
+
* @param {unknown} val
|
|
462
|
+
* @param {string} msg
|
|
488
463
|
* @namespace Assert
|
|
489
|
-
* @
|
|
464
|
+
* @public
|
|
490
465
|
*/
|
|
491
|
-
|
|
492
466
|
assert.exists = function (val, msg) {
|
|
493
467
|
new Assertion(val, msg, assert.exists, true).to.exist;
|
|
494
468
|
};
|
|
@@ -499,18 +473,17 @@ assert.exists = function (val, msg) {
|
|
|
499
473
|
* Asserts that the target is either `null` or `undefined`.
|
|
500
474
|
*
|
|
501
475
|
* var bar = null
|
|
502
|
-
*
|
|
476
|
+
* , baz;
|
|
503
477
|
*
|
|
504
478
|
* assert.notExists(bar);
|
|
505
479
|
* assert.notExists(baz, 'baz is either null or undefined');
|
|
506
480
|
*
|
|
507
481
|
* @name notExists
|
|
508
|
-
* @param {
|
|
509
|
-
* @param {
|
|
482
|
+
* @param {unknown} val
|
|
483
|
+
* @param {string} msg
|
|
510
484
|
* @namespace Assert
|
|
511
|
-
* @
|
|
485
|
+
* @public
|
|
512
486
|
*/
|
|
513
|
-
|
|
514
487
|
assert.notExists = function (val, msg) {
|
|
515
488
|
new Assertion(val, msg, assert.notExists, true).to.not.exist;
|
|
516
489
|
};
|
|
@@ -524,12 +497,11 @@ assert.notExists = function (val, msg) {
|
|
|
524
497
|
* assert.isUndefined(tea, 'no tea defined');
|
|
525
498
|
*
|
|
526
499
|
* @name isUndefined
|
|
527
|
-
* @param {
|
|
528
|
-
* @param {
|
|
500
|
+
* @param {unknown} val
|
|
501
|
+
* @param {string} msg
|
|
529
502
|
* @namespace Assert
|
|
530
|
-
* @
|
|
503
|
+
* @public
|
|
531
504
|
*/
|
|
532
|
-
|
|
533
505
|
assert.isUndefined = function (val, msg) {
|
|
534
506
|
new Assertion(val, msg, assert.isUndefined, true).to.equal(undefined);
|
|
535
507
|
};
|
|
@@ -543,12 +515,11 @@ assert.isUndefined = function (val, msg) {
|
|
|
543
515
|
* assert.isDefined(tea, 'tea has been defined');
|
|
544
516
|
*
|
|
545
517
|
* @name isDefined
|
|
546
|
-
* @param {
|
|
547
|
-
* @param {
|
|
518
|
+
* @param {unknown} val
|
|
519
|
+
* @param {string} msg
|
|
548
520
|
* @namespace Assert
|
|
549
|
-
* @
|
|
521
|
+
* @public
|
|
550
522
|
*/
|
|
551
|
-
|
|
552
523
|
assert.isDefined = function (val, msg) {
|
|
553
524
|
new Assertion(val, msg, assert.isDefined, true).to.not.equal(undefined);
|
|
554
525
|
};
|
|
@@ -562,13 +533,13 @@ assert.isDefined = function (val, msg) {
|
|
|
562
533
|
* assert.isCallable(serveTea, 'great, we can have tea now');
|
|
563
534
|
*
|
|
564
535
|
* @name isCallable
|
|
565
|
-
* @param {
|
|
566
|
-
* @param {
|
|
536
|
+
* @param {unknown} value
|
|
537
|
+
* @param {string} message
|
|
567
538
|
* @namespace Assert
|
|
568
|
-
* @
|
|
539
|
+
* @public
|
|
569
540
|
*/
|
|
570
|
-
assert.isCallable = function (
|
|
571
|
-
new Assertion(
|
|
541
|
+
assert.isCallable = function (value, message) {
|
|
542
|
+
new Assertion(value, message, assert.isCallable, true).is.callable;
|
|
572
543
|
}
|
|
573
544
|
|
|
574
545
|
/**
|
|
@@ -580,13 +551,13 @@ assert.isCallable = function (val, msg) {
|
|
|
580
551
|
* assert.isNotCallable(serveTea, 'great, we have listed the steps');
|
|
581
552
|
*
|
|
582
553
|
* @name isNotCallable
|
|
583
|
-
* @param {
|
|
584
|
-
* @param {
|
|
554
|
+
* @param {unknown} value
|
|
555
|
+
* @param {string} message
|
|
585
556
|
* @namespace Assert
|
|
586
|
-
* @
|
|
557
|
+
* @public
|
|
587
558
|
*/
|
|
588
|
-
assert.isNotCallable = function (
|
|
589
|
-
new Assertion(
|
|
559
|
+
assert.isNotCallable = function (value, message) {
|
|
560
|
+
new Assertion(value, message, assert.isNotCallable, true).is.not.callable;
|
|
590
561
|
};
|
|
591
562
|
|
|
592
563
|
/**
|
|
@@ -599,12 +570,11 @@ assert.isNotCallable = function (val, msg) {
|
|
|
599
570
|
* assert.isObject(selection, 'tea selection is an object');
|
|
600
571
|
*
|
|
601
572
|
* @name isObject
|
|
602
|
-
* @param {
|
|
603
|
-
* @param {
|
|
573
|
+
* @param {unknown} val
|
|
574
|
+
* @param {string} msg
|
|
604
575
|
* @namespace Assert
|
|
605
|
-
* @
|
|
576
|
+
* @public
|
|
606
577
|
*/
|
|
607
|
-
|
|
608
578
|
assert.isObject = function (val, msg) {
|
|
609
579
|
new Assertion(val, msg, assert.isObject, true).to.be.a('object');
|
|
610
580
|
};
|
|
@@ -619,12 +589,11 @@ assert.isObject = function (val, msg) {
|
|
|
619
589
|
* assert.isNotObject(null, 'null is not an object');
|
|
620
590
|
*
|
|
621
591
|
* @name isNotObject
|
|
622
|
-
* @param {
|
|
623
|
-
* @param {
|
|
592
|
+
* @param {unknown} val
|
|
593
|
+
* @param {string} msg
|
|
624
594
|
* @namespace Assert
|
|
625
|
-
* @
|
|
595
|
+
* @public
|
|
626
596
|
*/
|
|
627
|
-
|
|
628
597
|
assert.isNotObject = function (val, msg) {
|
|
629
598
|
new Assertion(val, msg, assert.isNotObject, true).to.not.be.a('object');
|
|
630
599
|
};
|
|
@@ -638,12 +607,11 @@ assert.isNotObject = function (val, msg) {
|
|
|
638
607
|
* assert.isArray(menu, 'what kind of tea do we want?');
|
|
639
608
|
*
|
|
640
609
|
* @name isArray
|
|
641
|
-
* @param {
|
|
642
|
-
* @param {
|
|
610
|
+
* @param {unknown} val
|
|
611
|
+
* @param {string} msg
|
|
643
612
|
* @namespace Assert
|
|
644
|
-
* @
|
|
613
|
+
* @public
|
|
645
614
|
*/
|
|
646
|
-
|
|
647
615
|
assert.isArray = function (val, msg) {
|
|
648
616
|
new Assertion(val, msg, assert.isArray, true).to.be.an('array');
|
|
649
617
|
};
|
|
@@ -657,12 +625,11 @@ assert.isArray = function (val, msg) {
|
|
|
657
625
|
* assert.isNotArray(menu, 'what kind of tea do we want?');
|
|
658
626
|
*
|
|
659
627
|
* @name isNotArray
|
|
660
|
-
* @param {
|
|
661
|
-
* @param {
|
|
628
|
+
* @param {unknown} val
|
|
629
|
+
* @param {string} msg
|
|
662
630
|
* @namespace Assert
|
|
663
|
-
* @
|
|
631
|
+
* @public
|
|
664
632
|
*/
|
|
665
|
-
|
|
666
633
|
assert.isNotArray = function (val, msg) {
|
|
667
634
|
new Assertion(val, msg, assert.isNotArray, true).to.not.be.an('array');
|
|
668
635
|
};
|
|
@@ -676,12 +643,11 @@ assert.isNotArray = function (val, msg) {
|
|
|
676
643
|
* assert.isString(teaOrder, 'order placed');
|
|
677
644
|
*
|
|
678
645
|
* @name isString
|
|
679
|
-
* @param {
|
|
680
|
-
* @param {
|
|
646
|
+
* @param {unknown} val
|
|
647
|
+
* @param {string} msg
|
|
681
648
|
* @namespace Assert
|
|
682
|
-
* @
|
|
649
|
+
* @public
|
|
683
650
|
*/
|
|
684
|
-
|
|
685
651
|
assert.isString = function (val, msg) {
|
|
686
652
|
new Assertion(val, msg, assert.isString, true).to.be.a('string');
|
|
687
653
|
};
|
|
@@ -695,12 +661,11 @@ assert.isString = function (val, msg) {
|
|
|
695
661
|
* assert.isNotString(teaOrder, 'order placed');
|
|
696
662
|
*
|
|
697
663
|
* @name isNotString
|
|
698
|
-
* @param {
|
|
699
|
-
* @param {
|
|
664
|
+
* @param {unknown} val
|
|
665
|
+
* @param {string} msg
|
|
700
666
|
* @namespace Assert
|
|
701
|
-
* @
|
|
667
|
+
* @public
|
|
702
668
|
*/
|
|
703
|
-
|
|
704
669
|
assert.isNotString = function (val, msg) {
|
|
705
670
|
new Assertion(val, msg, assert.isNotString, true).to.not.be.a('string');
|
|
706
671
|
};
|
|
@@ -714,12 +679,11 @@ assert.isNotString = function (val, msg) {
|
|
|
714
679
|
* assert.isNumber(cups, 'how many cups');
|
|
715
680
|
*
|
|
716
681
|
* @name isNumber
|
|
717
|
-
* @param {
|
|
718
|
-
* @param {
|
|
682
|
+
* @param {number} val
|
|
683
|
+
* @param {string} msg
|
|
719
684
|
* @namespace Assert
|
|
720
|
-
* @
|
|
685
|
+
* @public
|
|
721
686
|
*/
|
|
722
|
-
|
|
723
687
|
assert.isNumber = function (val, msg) {
|
|
724
688
|
new Assertion(val, msg, assert.isNumber, true).to.be.a('number');
|
|
725
689
|
};
|
|
@@ -733,33 +697,30 @@ assert.isNumber = function (val, msg) {
|
|
|
733
697
|
* assert.isNotNumber(cups, 'how many cups');
|
|
734
698
|
*
|
|
735
699
|
* @name isNotNumber
|
|
736
|
-
* @param {
|
|
737
|
-
* @param {
|
|
700
|
+
* @param {unknown} val
|
|
701
|
+
* @param {string} msg
|
|
738
702
|
* @namespace Assert
|
|
739
|
-
* @
|
|
703
|
+
* @public
|
|
740
704
|
*/
|
|
741
|
-
|
|
742
705
|
assert.isNotNumber = function (val, msg) {
|
|
743
706
|
new Assertion(val, msg, assert.isNotNumber, true).to.not.be.a('number');
|
|
744
707
|
};
|
|
745
708
|
|
|
746
709
|
/**
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
*/
|
|
762
|
-
|
|
710
|
+
* ### .isFinite(value, [message])
|
|
711
|
+
*
|
|
712
|
+
* Asserts that `value` is a finite number. Unlike `.isNumber`, this will fail for `NaN` and `Infinity`.
|
|
713
|
+
*
|
|
714
|
+
* var cups = 2;
|
|
715
|
+
* assert.isFinite(cups, 'how many cups');
|
|
716
|
+
* assert.isFinite(NaN); // throws
|
|
717
|
+
*
|
|
718
|
+
* @name isFinite
|
|
719
|
+
* @param {number} val
|
|
720
|
+
* @param {string} msg
|
|
721
|
+
* @namespace Assert
|
|
722
|
+
* @public
|
|
723
|
+
*/
|
|
763
724
|
assert.isFinite = function (val, msg) {
|
|
764
725
|
new Assertion(val, msg, assert.isFinite, true).to.be.finite;
|
|
765
726
|
};
|
|
@@ -770,18 +731,17 @@ assert.isFinite = function (val, msg) {
|
|
|
770
731
|
* Asserts that `value` is a boolean.
|
|
771
732
|
*
|
|
772
733
|
* var teaReady = true
|
|
773
|
-
*
|
|
734
|
+
* , teaServed = false;
|
|
774
735
|
*
|
|
775
736
|
* assert.isBoolean(teaReady, 'is the tea ready');
|
|
776
737
|
* assert.isBoolean(teaServed, 'has tea been served');
|
|
777
738
|
*
|
|
778
739
|
* @name isBoolean
|
|
779
|
-
* @param {
|
|
780
|
-
* @param {
|
|
740
|
+
* @param {unknown} val
|
|
741
|
+
* @param {string} msg
|
|
781
742
|
* @namespace Assert
|
|
782
|
-
* @
|
|
743
|
+
* @public
|
|
783
744
|
*/
|
|
784
|
-
|
|
785
745
|
assert.isBoolean = function (val, msg) {
|
|
786
746
|
new Assertion(val, msg, assert.isBoolean, true).to.be.a('boolean');
|
|
787
747
|
};
|
|
@@ -792,18 +752,17 @@ assert.isBoolean = function (val, msg) {
|
|
|
792
752
|
* Asserts that `value` is _not_ a boolean.
|
|
793
753
|
*
|
|
794
754
|
* var teaReady = 'yep'
|
|
795
|
-
*
|
|
755
|
+
* , teaServed = 'nope';
|
|
796
756
|
*
|
|
797
757
|
* assert.isNotBoolean(teaReady, 'is the tea ready');
|
|
798
758
|
* assert.isNotBoolean(teaServed, 'has tea been served');
|
|
799
759
|
*
|
|
800
760
|
* @name isNotBoolean
|
|
801
|
-
* @param {
|
|
802
|
-
* @param {
|
|
761
|
+
* @param {unknown} val
|
|
762
|
+
* @param {string} msg
|
|
803
763
|
* @namespace Assert
|
|
804
|
-
* @
|
|
764
|
+
* @public
|
|
805
765
|
*/
|
|
806
|
-
|
|
807
766
|
assert.isNotBoolean = function (val, msg) {
|
|
808
767
|
new Assertion(val, msg, assert.isNotBoolean, true).to.not.be.a('boolean');
|
|
809
768
|
};
|
|
@@ -822,13 +781,12 @@ assert.isNotBoolean = function (val, msg) {
|
|
|
822
781
|
* assert.typeOf(undefined, 'undefined', 'we have an undefined');
|
|
823
782
|
*
|
|
824
783
|
* @name typeOf
|
|
825
|
-
* @param {
|
|
826
|
-
* @param {
|
|
827
|
-
* @param {
|
|
784
|
+
* @param {unknown} val
|
|
785
|
+
* @param {string} type
|
|
786
|
+
* @param {string} msg
|
|
828
787
|
* @namespace Assert
|
|
829
|
-
* @
|
|
788
|
+
* @public
|
|
830
789
|
*/
|
|
831
|
-
|
|
832
790
|
assert.typeOf = function (val, type, msg) {
|
|
833
791
|
new Assertion(val, msg, assert.typeOf, true).to.be.a(type);
|
|
834
792
|
};
|
|
@@ -842,15 +800,14 @@ assert.typeOf = function (val, type, msg) {
|
|
|
842
800
|
* assert.notTypeOf('tea', 'number', 'strings are not numbers');
|
|
843
801
|
*
|
|
844
802
|
* @name notTypeOf
|
|
845
|
-
* @param {
|
|
846
|
-
* @param {
|
|
847
|
-
* @param {
|
|
803
|
+
* @param {unknown} value
|
|
804
|
+
* @param {string} type
|
|
805
|
+
* @param {string} message
|
|
848
806
|
* @namespace Assert
|
|
849
|
-
* @
|
|
807
|
+
* @public
|
|
850
808
|
*/
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
new Assertion(val, msg, assert.notTypeOf, true).to.not.be.a(type);
|
|
809
|
+
assert.notTypeOf = function (value, type, message) {
|
|
810
|
+
new Assertion(value, message, assert.notTypeOf, true).to.not.be.a(type);
|
|
854
811
|
};
|
|
855
812
|
|
|
856
813
|
/**
|
|
@@ -859,18 +816,17 @@ assert.notTypeOf = function (val, type, msg) {
|
|
|
859
816
|
* Asserts that `value` is an instance of `constructor`.
|
|
860
817
|
*
|
|
861
818
|
* var Tea = function (name) { this.name = name; }
|
|
862
|
-
*
|
|
819
|
+
* , chai = new Tea('chai');
|
|
863
820
|
*
|
|
864
821
|
* assert.instanceOf(chai, Tea, 'chai is an instance of tea');
|
|
865
822
|
*
|
|
866
823
|
* @name instanceOf
|
|
867
|
-
* @param {
|
|
868
|
-
* @param {
|
|
869
|
-
* @param {
|
|
824
|
+
* @param {object} val
|
|
825
|
+
* @param {object} type
|
|
826
|
+
* @param {string} msg
|
|
870
827
|
* @namespace Assert
|
|
871
|
-
* @
|
|
828
|
+
* @public
|
|
872
829
|
*/
|
|
873
|
-
|
|
874
830
|
assert.instanceOf = function (val, type, msg) {
|
|
875
831
|
new Assertion(val, msg, assert.instanceOf, true).to.be.instanceOf(type);
|
|
876
832
|
};
|
|
@@ -881,18 +837,17 @@ assert.instanceOf = function (val, type, msg) {
|
|
|
881
837
|
* Asserts `value` is not an instance of `constructor`.
|
|
882
838
|
*
|
|
883
839
|
* var Tea = function (name) { this.name = name; }
|
|
884
|
-
*
|
|
840
|
+
* , chai = new String('chai');
|
|
885
841
|
*
|
|
886
842
|
* assert.notInstanceOf(chai, Tea, 'chai is not an instance of tea');
|
|
887
843
|
*
|
|
888
844
|
* @name notInstanceOf
|
|
889
|
-
* @param {
|
|
890
|
-
* @param {
|
|
891
|
-
* @param {
|
|
845
|
+
* @param {object} val
|
|
846
|
+
* @param {object} type
|
|
847
|
+
* @param {string} msg
|
|
892
848
|
* @namespace Assert
|
|
893
|
-
* @
|
|
849
|
+
* @public
|
|
894
850
|
*/
|
|
895
|
-
|
|
896
851
|
assert.notInstanceOf = function (val, type, msg) {
|
|
897
852
|
new Assertion(val, msg, assert.notInstanceOf, true)
|
|
898
853
|
.to.not.be.instanceOf(type);
|
|
@@ -916,19 +871,18 @@ assert.notInstanceOf = function (val, type, msg) {
|
|
|
916
871
|
* and strictly equal to the given property value. For instance:
|
|
917
872
|
*
|
|
918
873
|
* var obj1 = {a: 1}
|
|
919
|
-
*
|
|
874
|
+
* , obj2 = {b: 2};
|
|
920
875
|
* assert.include([obj1, obj2], obj1);
|
|
921
876
|
* assert.include({foo: obj1, bar: obj2}, {foo: obj1});
|
|
922
877
|
* assert.include({foo: obj1, bar: obj2}, {foo: obj1, bar: obj2});
|
|
923
878
|
*
|
|
924
879
|
* @name include
|
|
925
|
-
* @param {Array|
|
|
926
|
-
* @param {
|
|
927
|
-
* @param {
|
|
880
|
+
* @param {Array | string} exp
|
|
881
|
+
* @param {unknown} inc
|
|
882
|
+
* @param {string} msg
|
|
928
883
|
* @namespace Assert
|
|
929
|
-
* @
|
|
884
|
+
* @public
|
|
930
885
|
*/
|
|
931
|
-
|
|
932
886
|
assert.include = function (exp, inc, msg) {
|
|
933
887
|
new Assertion(exp, msg, assert.include, true).include(inc);
|
|
934
888
|
};
|
|
@@ -952,19 +906,18 @@ assert.include = function (exp, inc, msg) {
|
|
|
952
906
|
* property value. For instance:
|
|
953
907
|
*
|
|
954
908
|
* var obj1 = {a: 1}
|
|
955
|
-
*
|
|
909
|
+
* , obj2 = {b: 2};
|
|
956
910
|
* assert.notInclude([obj1, obj2], {a: 1});
|
|
957
911
|
* assert.notInclude({foo: obj1, bar: obj2}, {foo: {a: 1}});
|
|
958
912
|
* assert.notInclude({foo: obj1, bar: obj2}, {foo: obj1, bar: {b: 2}});
|
|
959
913
|
*
|
|
960
914
|
* @name notInclude
|
|
961
|
-
* @param {Array|
|
|
962
|
-
* @param {
|
|
963
|
-
* @param {
|
|
915
|
+
* @param {Array | string} exp
|
|
916
|
+
* @param {unknown} inc
|
|
917
|
+
* @param {string} msg
|
|
964
918
|
* @namespace Assert
|
|
965
|
-
* @
|
|
919
|
+
* @public
|
|
966
920
|
*/
|
|
967
|
-
|
|
968
921
|
assert.notInclude = function (exp, inc, msg) {
|
|
969
922
|
new Assertion(exp, msg, assert.notInclude, true).not.include(inc);
|
|
970
923
|
};
|
|
@@ -977,19 +930,18 @@ assert.notInclude = function (exp, inc, msg) {
|
|
|
977
930
|
* Deep equality is used.
|
|
978
931
|
*
|
|
979
932
|
* var obj1 = {a: 1}
|
|
980
|
-
*
|
|
933
|
+
* , obj2 = {b: 2};
|
|
981
934
|
* assert.deepInclude([obj1, obj2], {a: 1});
|
|
982
935
|
* assert.deepInclude({foo: obj1, bar: obj2}, {foo: {a: 1}});
|
|
983
936
|
* assert.deepInclude({foo: obj1, bar: obj2}, {foo: {a: 1}, bar: {b: 2}});
|
|
984
937
|
*
|
|
985
938
|
* @name deepInclude
|
|
986
|
-
* @param {Array|
|
|
987
|
-
* @param {
|
|
988
|
-
* @param {
|
|
939
|
+
* @param {Array | string} exp
|
|
940
|
+
* @param {unknown} inc
|
|
941
|
+
* @param {string} msg
|
|
989
942
|
* @namespace Assert
|
|
990
|
-
* @
|
|
943
|
+
* @public
|
|
991
944
|
*/
|
|
992
|
-
|
|
993
945
|
assert.deepInclude = function (exp, inc, msg) {
|
|
994
946
|
new Assertion(exp, msg, assert.deepInclude, true).deep.include(inc);
|
|
995
947
|
};
|
|
@@ -1002,19 +954,18 @@ assert.deepInclude = function (exp, inc, msg) {
|
|
|
1002
954
|
* Deep equality is used.
|
|
1003
955
|
*
|
|
1004
956
|
* var obj1 = {a: 1}
|
|
1005
|
-
*
|
|
957
|
+
* , obj2 = {b: 2};
|
|
1006
958
|
* assert.notDeepInclude([obj1, obj2], {a: 9});
|
|
1007
959
|
* assert.notDeepInclude({foo: obj1, bar: obj2}, {foo: {a: 9}});
|
|
1008
960
|
* assert.notDeepInclude({foo: obj1, bar: obj2}, {foo: {a: 1}, bar: {b: 9}});
|
|
1009
961
|
*
|
|
1010
962
|
* @name notDeepInclude
|
|
1011
|
-
* @param {Array|
|
|
1012
|
-
* @param {
|
|
1013
|
-
* @param {
|
|
963
|
+
* @param {Array | string} exp
|
|
964
|
+
* @param {unknown} inc
|
|
965
|
+
* @param {string} msg
|
|
1014
966
|
* @namespace Assert
|
|
1015
|
-
* @
|
|
967
|
+
* @public
|
|
1016
968
|
*/
|
|
1017
|
-
|
|
1018
969
|
assert.notDeepInclude = function (exp, inc, msg) {
|
|
1019
970
|
new Assertion(exp, msg, assert.notDeepInclude, true).not.deep.include(inc);
|
|
1020
971
|
};
|
|
@@ -1033,13 +984,12 @@ assert.notDeepInclude = function (exp, inc, msg) {
|
|
|
1033
984
|
* assert.nestedInclude({'a': {'[b]': 'x'}}, {'a.\\[b\\]': 'x'});
|
|
1034
985
|
*
|
|
1035
986
|
* @name nestedInclude
|
|
1036
|
-
* @param {
|
|
1037
|
-
* @param {
|
|
1038
|
-
* @param {
|
|
987
|
+
* @param {object} exp
|
|
988
|
+
* @param {object} inc
|
|
989
|
+
* @param {string} msg
|
|
1039
990
|
* @namespace Assert
|
|
1040
|
-
* @
|
|
991
|
+
* @public
|
|
1041
992
|
*/
|
|
1042
|
-
|
|
1043
993
|
assert.nestedInclude = function (exp, inc, msg) {
|
|
1044
994
|
new Assertion(exp, msg, assert.nestedInclude, true).nested.include(inc);
|
|
1045
995
|
};
|
|
@@ -1058,13 +1008,12 @@ assert.nestedInclude = function (exp, inc, msg) {
|
|
|
1058
1008
|
* assert.notNestedInclude({'a': {'[b]': 'x'}}, {'a.\\[b\\]': 'y'});
|
|
1059
1009
|
*
|
|
1060
1010
|
* @name notNestedInclude
|
|
1061
|
-
* @param {
|
|
1062
|
-
* @param {
|
|
1063
|
-
* @param {
|
|
1011
|
+
* @param {object} exp
|
|
1012
|
+
* @param {object} inc
|
|
1013
|
+
* @param {string} msg
|
|
1064
1014
|
* @namespace Assert
|
|
1065
|
-
* @
|
|
1015
|
+
* @public
|
|
1066
1016
|
*/
|
|
1067
|
-
|
|
1068
1017
|
assert.notNestedInclude = function (exp, inc, msg) {
|
|
1069
1018
|
new Assertion(exp, msg, assert.notNestedInclude, true)
|
|
1070
1019
|
.not.nested.include(inc);
|
|
@@ -1084,13 +1033,12 @@ assert.notNestedInclude = function (exp, inc, msg) {
|
|
|
1084
1033
|
* assert.deepNestedInclude({'.a': {'[b]': {x: 1}}}, {'\\.a.\\[b\\]': {x: 1}});
|
|
1085
1034
|
*
|
|
1086
1035
|
* @name deepNestedInclude
|
|
1087
|
-
* @param {
|
|
1088
|
-
* @param {
|
|
1089
|
-
* @param {
|
|
1036
|
+
* @param {object} exp
|
|
1037
|
+
* @param {object} inc
|
|
1038
|
+
* @param {string} msg
|
|
1090
1039
|
* @namespace Assert
|
|
1091
|
-
* @
|
|
1040
|
+
* @public
|
|
1092
1041
|
*/
|
|
1093
|
-
|
|
1094
1042
|
assert.deepNestedInclude = function(exp, inc, msg) {
|
|
1095
1043
|
new Assertion(exp, msg, assert.deepNestedInclude, true)
|
|
1096
1044
|
.deep.nested.include(inc);
|
|
@@ -1110,13 +1058,12 @@ assert.deepNestedInclude = function(exp, inc, msg) {
|
|
|
1110
1058
|
* assert.notDeepNestedInclude({'.a': {'[b]': {x: 1}}}, {'\\.a.\\[b\\]': {y: 2}});
|
|
1111
1059
|
*
|
|
1112
1060
|
* @name notDeepNestedInclude
|
|
1113
|
-
* @param {
|
|
1114
|
-
* @param {
|
|
1115
|
-
* @param {
|
|
1061
|
+
* @param {object} exp
|
|
1062
|
+
* @param {object} inc
|
|
1063
|
+
* @param {string} msg
|
|
1116
1064
|
* @namespace Assert
|
|
1117
|
-
* @
|
|
1065
|
+
* @public
|
|
1118
1066
|
*/
|
|
1119
|
-
|
|
1120
1067
|
assert.notDeepNestedInclude = function(exp, inc, msg) {
|
|
1121
1068
|
new Assertion(exp, msg, assert.notDeepNestedInclude, true)
|
|
1122
1069
|
.not.deep.nested.include(inc);
|
|
@@ -1132,13 +1079,12 @@ assert.notDeepNestedInclude = function(exp, inc, msg) {
|
|
|
1132
1079
|
* assert.ownInclude({ a: 1 }, { a: 1 });
|
|
1133
1080
|
*
|
|
1134
1081
|
* @name ownInclude
|
|
1135
|
-
* @param {
|
|
1136
|
-
* @param {
|
|
1137
|
-
* @param {
|
|
1082
|
+
* @param {object} exp
|
|
1083
|
+
* @param {object} inc
|
|
1084
|
+
* @param {string} msg
|
|
1138
1085
|
* @namespace Assert
|
|
1139
|
-
* @
|
|
1086
|
+
* @public
|
|
1140
1087
|
*/
|
|
1141
|
-
|
|
1142
1088
|
assert.ownInclude = function(exp, inc, msg) {
|
|
1143
1089
|
new Assertion(exp, msg, assert.ownInclude, true).own.include(inc);
|
|
1144
1090
|
};
|
|
@@ -1146,22 +1092,20 @@ assert.ownInclude = function(exp, inc, msg) {
|
|
|
1146
1092
|
/**
|
|
1147
1093
|
* ### .notOwnInclude(haystack, needle, [message])
|
|
1148
1094
|
*
|
|
1149
|
-
* Asserts that 'haystack'
|
|
1095
|
+
* Asserts that 'haystack' does not include 'needle'.
|
|
1150
1096
|
* Can be used to assert the absence of a subset of properties in an
|
|
1151
1097
|
* object while ignoring inherited properties.
|
|
1152
1098
|
*
|
|
1153
1099
|
* Object.prototype.b = 2;
|
|
1154
|
-
*
|
|
1155
1100
|
* assert.notOwnInclude({ a: 1 }, { b: 2 });
|
|
1156
1101
|
*
|
|
1157
1102
|
* @name notOwnInclude
|
|
1158
|
-
* @param {
|
|
1159
|
-
* @param {
|
|
1160
|
-
* @param {
|
|
1103
|
+
* @param {object} exp
|
|
1104
|
+
* @param {object} inc
|
|
1105
|
+
* @param {string} msg
|
|
1161
1106
|
* @namespace Assert
|
|
1162
|
-
* @
|
|
1107
|
+
* @public
|
|
1163
1108
|
*/
|
|
1164
|
-
|
|
1165
1109
|
assert.notOwnInclude = function(exp, inc, msg) {
|
|
1166
1110
|
new Assertion(exp, msg, assert.notOwnInclude, true).not.own.include(inc);
|
|
1167
1111
|
};
|
|
@@ -1173,38 +1117,36 @@ assert.notOwnInclude = function(exp, inc, msg) {
|
|
|
1173
1117
|
* Can be used to assert the inclusion of a subset of properties in an
|
|
1174
1118
|
* object while ignoring inherited properties and checking for deep equality.
|
|
1175
1119
|
*
|
|
1176
|
-
*
|
|
1120
|
+
* assert.deepOwnInclude({a: {b: 2}}, {a: {b: 2}});
|
|
1177
1121
|
*
|
|
1178
1122
|
* @name deepOwnInclude
|
|
1179
|
-
* @param {
|
|
1180
|
-
* @param {
|
|
1181
|
-
* @param {
|
|
1123
|
+
* @param {object} exp
|
|
1124
|
+
* @param {object} inc
|
|
1125
|
+
* @param {string} msg
|
|
1182
1126
|
* @namespace Assert
|
|
1183
|
-
* @
|
|
1127
|
+
* @public
|
|
1184
1128
|
*/
|
|
1185
|
-
|
|
1186
1129
|
assert.deepOwnInclude = function(exp, inc, msg) {
|
|
1187
1130
|
new Assertion(exp, msg, assert.deepOwnInclude, true)
|
|
1188
1131
|
.deep.own.include(inc);
|
|
1189
1132
|
};
|
|
1190
1133
|
|
|
1191
|
-
|
|
1134
|
+
/**
|
|
1192
1135
|
* ### .notDeepOwnInclude(haystack, needle, [message])
|
|
1193
1136
|
*
|
|
1194
1137
|
* Asserts that 'haystack' includes 'needle'.
|
|
1195
1138
|
* Can be used to assert the absence of a subset of properties in an
|
|
1196
1139
|
* object while ignoring inherited properties and checking for deep equality.
|
|
1197
1140
|
*
|
|
1198
|
-
*
|
|
1141
|
+
* assert.notDeepOwnInclude({a: {b: 2}}, {a: {c: 3}});
|
|
1199
1142
|
*
|
|
1200
1143
|
* @name notDeepOwnInclude
|
|
1201
|
-
* @param {
|
|
1202
|
-
* @param {
|
|
1203
|
-
* @param {
|
|
1144
|
+
* @param {object} exp
|
|
1145
|
+
* @param {object} inc
|
|
1146
|
+
* @param {string} msg
|
|
1204
1147
|
* @namespace Assert
|
|
1205
|
-
* @
|
|
1148
|
+
* @public
|
|
1206
1149
|
*/
|
|
1207
|
-
|
|
1208
1150
|
assert.notDeepOwnInclude = function(exp, inc, msg) {
|
|
1209
1151
|
new Assertion(exp, msg, assert.notDeepOwnInclude, true)
|
|
1210
1152
|
.not.deep.own.include(inc);
|
|
@@ -1218,13 +1160,12 @@ assert.notDeepOwnInclude = function(exp, inc, msg) {
|
|
|
1218
1160
|
* assert.match('foobar', /^foo/, 'regexp matches');
|
|
1219
1161
|
*
|
|
1220
1162
|
* @name match
|
|
1221
|
-
* @param {
|
|
1222
|
-
* @param {RegExp}
|
|
1223
|
-
* @param {
|
|
1163
|
+
* @param {unknown} exp
|
|
1164
|
+
* @param {RegExp} re
|
|
1165
|
+
* @param {string} msg
|
|
1224
1166
|
* @namespace Assert
|
|
1225
|
-
* @
|
|
1167
|
+
* @public
|
|
1226
1168
|
*/
|
|
1227
|
-
|
|
1228
1169
|
assert.match = function (exp, re, msg) {
|
|
1229
1170
|
new Assertion(exp, msg, assert.match, true).to.match(re);
|
|
1230
1171
|
};
|
|
@@ -1237,13 +1178,12 @@ assert.match = function (exp, re, msg) {
|
|
|
1237
1178
|
* assert.notMatch('foobar', /^foo/, 'regexp does not match');
|
|
1238
1179
|
*
|
|
1239
1180
|
* @name notMatch
|
|
1240
|
-
* @param {
|
|
1241
|
-
* @param {RegExp}
|
|
1242
|
-
* @param {
|
|
1181
|
+
* @param {unknown} exp
|
|
1182
|
+
* @param {RegExp} re
|
|
1183
|
+
* @param {string} msg
|
|
1243
1184
|
* @namespace Assert
|
|
1244
|
-
* @
|
|
1185
|
+
* @public
|
|
1245
1186
|
*/
|
|
1246
|
-
|
|
1247
1187
|
assert.notMatch = function (exp, re, msg) {
|
|
1248
1188
|
new Assertion(exp, msg, assert.notMatch, true).to.not.match(re);
|
|
1249
1189
|
};
|
|
@@ -1258,13 +1198,12 @@ assert.notMatch = function (exp, re, msg) {
|
|
|
1258
1198
|
* assert.property({ tea: { green: 'matcha' }}, 'toString');
|
|
1259
1199
|
*
|
|
1260
1200
|
* @name property
|
|
1261
|
-
* @param {
|
|
1262
|
-
* @param {
|
|
1263
|
-
* @param {
|
|
1201
|
+
* @param {object} obj
|
|
1202
|
+
* @param {string} prop
|
|
1203
|
+
* @param {string} msg
|
|
1264
1204
|
* @namespace Assert
|
|
1265
|
-
* @
|
|
1205
|
+
* @public
|
|
1266
1206
|
*/
|
|
1267
|
-
|
|
1268
1207
|
assert.property = function (obj, prop, msg) {
|
|
1269
1208
|
new Assertion(obj, msg, assert.property, true).to.have.property(prop);
|
|
1270
1209
|
};
|
|
@@ -1278,13 +1217,12 @@ assert.property = function (obj, prop, msg) {
|
|
|
1278
1217
|
* assert.notProperty({ tea: { green: 'matcha' }}, 'coffee');
|
|
1279
1218
|
*
|
|
1280
1219
|
* @name notProperty
|
|
1281
|
-
* @param {
|
|
1282
|
-
* @param {
|
|
1283
|
-
* @param {
|
|
1220
|
+
* @param {object} obj
|
|
1221
|
+
* @param {string} prop
|
|
1222
|
+
* @param {string} msg
|
|
1284
1223
|
* @namespace Assert
|
|
1285
|
-
* @
|
|
1224
|
+
* @public
|
|
1286
1225
|
*/
|
|
1287
|
-
|
|
1288
1226
|
assert.notProperty = function (obj, prop, msg) {
|
|
1289
1227
|
new Assertion(obj, msg, assert.notProperty, true)
|
|
1290
1228
|
.to.not.have.property(prop);
|
|
@@ -1300,14 +1238,13 @@ assert.notProperty = function (obj, prop, msg) {
|
|
|
1300
1238
|
* assert.propertyVal({ tea: 'is good' }, 'tea', 'is good');
|
|
1301
1239
|
*
|
|
1302
1240
|
* @name propertyVal
|
|
1303
|
-
* @param {
|
|
1304
|
-
* @param {
|
|
1305
|
-
* @param {
|
|
1306
|
-
* @param {
|
|
1241
|
+
* @param {object} obj
|
|
1242
|
+
* @param {string} prop
|
|
1243
|
+
* @param {unknown} val
|
|
1244
|
+
* @param {string} msg
|
|
1307
1245
|
* @namespace Assert
|
|
1308
|
-
* @
|
|
1246
|
+
* @public
|
|
1309
1247
|
*/
|
|
1310
|
-
|
|
1311
1248
|
assert.propertyVal = function (obj, prop, val, msg) {
|
|
1312
1249
|
new Assertion(obj, msg, assert.propertyVal, true)
|
|
1313
1250
|
.to.have.property(prop, val);
|
|
@@ -1324,14 +1261,13 @@ assert.propertyVal = function (obj, prop, val, msg) {
|
|
|
1324
1261
|
* assert.notPropertyVal({ tea: 'is good' }, 'coffee', 'is good');
|
|
1325
1262
|
*
|
|
1326
1263
|
* @name notPropertyVal
|
|
1327
|
-
* @param {
|
|
1328
|
-
* @param {
|
|
1329
|
-
* @param {
|
|
1330
|
-
* @param {
|
|
1264
|
+
* @param {object} obj
|
|
1265
|
+
* @param {string} prop
|
|
1266
|
+
* @param {unknown} val
|
|
1267
|
+
* @param {string} msg
|
|
1331
1268
|
* @namespace Assert
|
|
1332
|
-
* @
|
|
1269
|
+
* @public
|
|
1333
1270
|
*/
|
|
1334
|
-
|
|
1335
1271
|
assert.notPropertyVal = function (obj, prop, val, msg) {
|
|
1336
1272
|
new Assertion(obj, msg, assert.notPropertyVal, true)
|
|
1337
1273
|
.to.not.have.property(prop, val);
|
|
@@ -1346,14 +1282,13 @@ assert.notPropertyVal = function (obj, prop, val, msg) {
|
|
|
1346
1282
|
* assert.deepPropertyVal({ tea: { green: 'matcha' } }, 'tea', { green: 'matcha' });
|
|
1347
1283
|
*
|
|
1348
1284
|
* @name deepPropertyVal
|
|
1349
|
-
* @param {
|
|
1350
|
-
* @param {
|
|
1351
|
-
* @param {
|
|
1352
|
-
* @param {
|
|
1285
|
+
* @param {object} obj
|
|
1286
|
+
* @param {string} prop
|
|
1287
|
+
* @param {unknown} val
|
|
1288
|
+
* @param {string} msg
|
|
1353
1289
|
* @namespace Assert
|
|
1354
|
-
* @
|
|
1290
|
+
* @public
|
|
1355
1291
|
*/
|
|
1356
|
-
|
|
1357
1292
|
assert.deepPropertyVal = function (obj, prop, val, msg) {
|
|
1358
1293
|
new Assertion(obj, msg, assert.deepPropertyVal, true)
|
|
1359
1294
|
.to.have.deep.property(prop, val);
|
|
@@ -1370,14 +1305,13 @@ assert.deepPropertyVal = function (obj, prop, val, msg) {
|
|
|
1370
1305
|
* assert.notDeepPropertyVal({ tea: { green: 'matcha' } }, 'coffee', { green: 'matcha' });
|
|
1371
1306
|
*
|
|
1372
1307
|
* @name notDeepPropertyVal
|
|
1373
|
-
* @param {
|
|
1374
|
-
* @param {
|
|
1375
|
-
* @param {
|
|
1376
|
-
* @param {
|
|
1308
|
+
* @param {object} obj
|
|
1309
|
+
* @param {string} prop
|
|
1310
|
+
* @param {unknown} val
|
|
1311
|
+
* @param {string} msg
|
|
1377
1312
|
* @namespace Assert
|
|
1378
|
-
* @
|
|
1313
|
+
* @public
|
|
1379
1314
|
*/
|
|
1380
|
-
|
|
1381
1315
|
assert.notDeepPropertyVal = function (obj, prop, val, msg) {
|
|
1382
1316
|
new Assertion(obj, msg, assert.notDeepPropertyVal, true)
|
|
1383
1317
|
.to.not.have.deep.property(prop, val);
|
|
@@ -1392,12 +1326,11 @@ assert.notDeepPropertyVal = function (obj, prop, val, msg) {
|
|
|
1392
1326
|
* assert.ownProperty({ tea: { green: 'matcha' }}, 'tea');
|
|
1393
1327
|
*
|
|
1394
1328
|
* @name ownProperty
|
|
1395
|
-
* @param {
|
|
1396
|
-
* @param {
|
|
1397
|
-
* @param {
|
|
1398
|
-
* @
|
|
1329
|
+
* @param {object} obj
|
|
1330
|
+
* @param {string} prop
|
|
1331
|
+
* @param {string} msg
|
|
1332
|
+
* @public
|
|
1399
1333
|
*/
|
|
1400
|
-
|
|
1401
1334
|
assert.ownProperty = function (obj, prop, msg) {
|
|
1402
1335
|
new Assertion(obj, msg, assert.ownProperty, true)
|
|
1403
1336
|
.to.have.own.property(prop);
|
|
@@ -1413,12 +1346,11 @@ assert.ownProperty = function (obj, prop, msg) {
|
|
|
1413
1346
|
* assert.notOwnProperty({}, 'toString');
|
|
1414
1347
|
*
|
|
1415
1348
|
* @name notOwnProperty
|
|
1416
|
-
* @param {
|
|
1417
|
-
* @param {
|
|
1418
|
-
* @param {
|
|
1419
|
-
* @
|
|
1349
|
+
* @param {object} obj
|
|
1350
|
+
* @param {string} prop
|
|
1351
|
+
* @param {string} msg
|
|
1352
|
+
* @public
|
|
1420
1353
|
*/
|
|
1421
|
-
|
|
1422
1354
|
assert.notOwnProperty = function (obj, prop, msg) {
|
|
1423
1355
|
new Assertion(obj, msg, assert.notOwnProperty, true)
|
|
1424
1356
|
.to.not.have.own.property(prop);
|
|
@@ -1434,13 +1366,12 @@ assert.notOwnProperty = function (obj, prop, msg) {
|
|
|
1434
1366
|
* assert.ownPropertyVal({ coffee: 'is good'}, 'coffee', 'is good');
|
|
1435
1367
|
*
|
|
1436
1368
|
* @name ownPropertyVal
|
|
1437
|
-
* @param {
|
|
1438
|
-
* @param {
|
|
1439
|
-
* @param {
|
|
1440
|
-
* @param {
|
|
1441
|
-
* @
|
|
1369
|
+
* @param {object} obj
|
|
1370
|
+
* @param {string} prop
|
|
1371
|
+
* @param {unknown} value
|
|
1372
|
+
* @param {string} msg
|
|
1373
|
+
* @public
|
|
1442
1374
|
*/
|
|
1443
|
-
|
|
1444
1375
|
assert.ownPropertyVal = function (obj, prop, value, msg) {
|
|
1445
1376
|
new Assertion(obj, msg, assert.ownPropertyVal, true)
|
|
1446
1377
|
.to.have.own.property(prop, value);
|
|
@@ -1457,13 +1388,12 @@ assert.ownPropertyVal = function (obj, prop, value, msg) {
|
|
|
1457
1388
|
* assert.notOwnPropertyVal({}, 'toString', Object.prototype.toString);
|
|
1458
1389
|
*
|
|
1459
1390
|
* @name notOwnPropertyVal
|
|
1460
|
-
* @param {
|
|
1461
|
-
* @param {
|
|
1462
|
-
* @param {
|
|
1463
|
-
* @param {
|
|
1464
|
-
* @
|
|
1391
|
+
* @param {object} obj
|
|
1392
|
+
* @param {string} prop
|
|
1393
|
+
* @param {unknown} value
|
|
1394
|
+
* @param {string} msg
|
|
1395
|
+
* @public
|
|
1465
1396
|
*/
|
|
1466
|
-
|
|
1467
1397
|
assert.notOwnPropertyVal = function (obj, prop, value, msg) {
|
|
1468
1398
|
new Assertion(obj, msg, assert.notOwnPropertyVal, true)
|
|
1469
1399
|
.to.not.have.own.property(prop, value);
|
|
@@ -1479,13 +1409,12 @@ assert.notOwnPropertyVal = function (obj, prop, value, msg) {
|
|
|
1479
1409
|
* assert.deepOwnPropertyVal({ tea: { green: 'matcha' } }, 'tea', { green: 'matcha' });
|
|
1480
1410
|
*
|
|
1481
1411
|
* @name deepOwnPropertyVal
|
|
1482
|
-
* @param {
|
|
1483
|
-
* @param {
|
|
1484
|
-
* @param {
|
|
1485
|
-
* @param {
|
|
1486
|
-
* @
|
|
1412
|
+
* @param {object} obj
|
|
1413
|
+
* @param {string} prop
|
|
1414
|
+
* @param {unknown} value
|
|
1415
|
+
* @param {string} msg
|
|
1416
|
+
* @public
|
|
1487
1417
|
*/
|
|
1488
|
-
|
|
1489
1418
|
assert.deepOwnPropertyVal = function (obj, prop, value, msg) {
|
|
1490
1419
|
new Assertion(obj, msg, assert.deepOwnPropertyVal, true)
|
|
1491
1420
|
.to.have.deep.own.property(prop, value);
|
|
@@ -1504,13 +1433,12 @@ assert.deepOwnPropertyVal = function (obj, prop, value, msg) {
|
|
|
1504
1433
|
* assert.notDeepOwnPropertyVal({}, 'toString', Object.prototype.toString);
|
|
1505
1434
|
*
|
|
1506
1435
|
* @name notDeepOwnPropertyVal
|
|
1507
|
-
* @param {
|
|
1508
|
-
* @param {
|
|
1509
|
-
* @param {
|
|
1510
|
-
* @param {
|
|
1511
|
-
* @
|
|
1436
|
+
* @param {object} obj
|
|
1437
|
+
* @param {string} prop
|
|
1438
|
+
* @param {unknown} value
|
|
1439
|
+
* @param {string} msg
|
|
1440
|
+
* @public
|
|
1512
1441
|
*/
|
|
1513
|
-
|
|
1514
1442
|
assert.notDeepOwnPropertyVal = function (obj, prop, value, msg) {
|
|
1515
1443
|
new Assertion(obj, msg, assert.notDeepOwnPropertyVal, true)
|
|
1516
1444
|
.to.not.have.deep.own.property(prop, value);
|
|
@@ -1526,13 +1454,12 @@ assert.notDeepOwnPropertyVal = function (obj, prop, value, msg) {
|
|
|
1526
1454
|
* assert.nestedProperty({ tea: { green: 'matcha' }}, 'tea.green');
|
|
1527
1455
|
*
|
|
1528
1456
|
* @name nestedProperty
|
|
1529
|
-
* @param {
|
|
1530
|
-
* @param {
|
|
1531
|
-
* @param {
|
|
1457
|
+
* @param {object} obj
|
|
1458
|
+
* @param {string} prop
|
|
1459
|
+
* @param {string} msg
|
|
1532
1460
|
* @namespace Assert
|
|
1533
|
-
* @
|
|
1461
|
+
* @public
|
|
1534
1462
|
*/
|
|
1535
|
-
|
|
1536
1463
|
assert.nestedProperty = function (obj, prop, msg) {
|
|
1537
1464
|
new Assertion(obj, msg, assert.nestedProperty, true)
|
|
1538
1465
|
.to.have.nested.property(prop);
|
|
@@ -1548,13 +1475,12 @@ assert.nestedProperty = function (obj, prop, msg) {
|
|
|
1548
1475
|
* assert.notNestedProperty({ tea: { green: 'matcha' }}, 'tea.oolong');
|
|
1549
1476
|
*
|
|
1550
1477
|
* @name notNestedProperty
|
|
1551
|
-
* @param {
|
|
1552
|
-
* @param {
|
|
1553
|
-
* @param {
|
|
1478
|
+
* @param {object} obj
|
|
1479
|
+
* @param {string} prop
|
|
1480
|
+
* @param {string} msg
|
|
1554
1481
|
* @namespace Assert
|
|
1555
|
-
* @
|
|
1482
|
+
* @public
|
|
1556
1483
|
*/
|
|
1557
|
-
|
|
1558
1484
|
assert.notNestedProperty = function (obj, prop, msg) {
|
|
1559
1485
|
new Assertion(obj, msg, assert.notNestedProperty, true)
|
|
1560
1486
|
.to.not.have.nested.property(prop);
|
|
@@ -1570,14 +1496,13 @@ assert.notNestedProperty = function (obj, prop, msg) {
|
|
|
1570
1496
|
* assert.nestedPropertyVal({ tea: { green: 'matcha' }}, 'tea.green', 'matcha');
|
|
1571
1497
|
*
|
|
1572
1498
|
* @name nestedPropertyVal
|
|
1573
|
-
* @param {
|
|
1574
|
-
* @param {
|
|
1575
|
-
* @param {
|
|
1576
|
-
* @param {
|
|
1499
|
+
* @param {object} obj
|
|
1500
|
+
* @param {string} prop
|
|
1501
|
+
* @param {unknown} val
|
|
1502
|
+
* @param {string} msg
|
|
1577
1503
|
* @namespace Assert
|
|
1578
|
-
* @
|
|
1504
|
+
* @public
|
|
1579
1505
|
*/
|
|
1580
|
-
|
|
1581
1506
|
assert.nestedPropertyVal = function (obj, prop, val, msg) {
|
|
1582
1507
|
new Assertion(obj, msg, assert.nestedPropertyVal, true)
|
|
1583
1508
|
.to.have.nested.property(prop, val);
|
|
@@ -1594,14 +1519,13 @@ assert.nestedPropertyVal = function (obj, prop, val, msg) {
|
|
|
1594
1519
|
* assert.notNestedPropertyVal({ tea: { green: 'matcha' }}, 'coffee.green', 'matcha');
|
|
1595
1520
|
*
|
|
1596
1521
|
* @name notNestedPropertyVal
|
|
1597
|
-
* @param {
|
|
1598
|
-
* @param {
|
|
1599
|
-
* @param {
|
|
1600
|
-
* @param {
|
|
1522
|
+
* @param {object} obj
|
|
1523
|
+
* @param {string} prop
|
|
1524
|
+
* @param {unknown} val
|
|
1525
|
+
* @param {string} msg
|
|
1601
1526
|
* @namespace Assert
|
|
1602
|
-
* @
|
|
1527
|
+
* @public
|
|
1603
1528
|
*/
|
|
1604
|
-
|
|
1605
1529
|
assert.notNestedPropertyVal = function (obj, prop, val, msg) {
|
|
1606
1530
|
new Assertion(obj, msg, assert.notNestedPropertyVal, true)
|
|
1607
1531
|
.to.not.have.nested.property(prop, val);
|
|
@@ -1617,14 +1541,13 @@ assert.notNestedPropertyVal = function (obj, prop, val, msg) {
|
|
|
1617
1541
|
* assert.deepNestedPropertyVal({ tea: { green: { matcha: 'yum' } } }, 'tea.green', { matcha: 'yum' });
|
|
1618
1542
|
*
|
|
1619
1543
|
* @name deepNestedPropertyVal
|
|
1620
|
-
* @param {
|
|
1621
|
-
* @param {
|
|
1622
|
-
* @param {
|
|
1623
|
-
* @param {
|
|
1544
|
+
* @param {object} obj
|
|
1545
|
+
* @param {string} prop
|
|
1546
|
+
* @param {unknown} val
|
|
1547
|
+
* @param {string} msg
|
|
1624
1548
|
* @namespace Assert
|
|
1625
|
-
* @
|
|
1549
|
+
* @public
|
|
1626
1550
|
*/
|
|
1627
|
-
|
|
1628
1551
|
assert.deepNestedPropertyVal = function (obj, prop, val, msg) {
|
|
1629
1552
|
new Assertion(obj, msg, assert.deepNestedPropertyVal, true)
|
|
1630
1553
|
.to.have.deep.nested.property(prop, val);
|
|
@@ -1642,14 +1565,13 @@ assert.deepNestedPropertyVal = function (obj, prop, val, msg) {
|
|
|
1642
1565
|
* assert.notDeepNestedPropertyVal({ tea: { green: { matcha: 'yum' } } }, 'tea.black', { matcha: 'yum' });
|
|
1643
1566
|
*
|
|
1644
1567
|
* @name notDeepNestedPropertyVal
|
|
1645
|
-
* @param {
|
|
1646
|
-
* @param {
|
|
1647
|
-
* @param {
|
|
1648
|
-
* @param {
|
|
1568
|
+
* @param {object} obj
|
|
1569
|
+
* @param {string} prop
|
|
1570
|
+
* @param {unknown} val
|
|
1571
|
+
* @param {string} msg
|
|
1649
1572
|
* @namespace Assert
|
|
1650
|
-
* @
|
|
1573
|
+
* @public
|
|
1651
1574
|
*/
|
|
1652
|
-
|
|
1653
1575
|
assert.notDeepNestedPropertyVal = function (obj, prop, val, msg) {
|
|
1654
1576
|
new Assertion(obj, msg, assert.notDeepNestedPropertyVal, true)
|
|
1655
1577
|
.to.not.have.deep.nested.property(prop, val);
|
|
@@ -1666,13 +1588,12 @@ assert.notDeepNestedPropertyVal = function (obj, prop, val, msg) {
|
|
|
1666
1588
|
* assert.lengthOf(new Map([['a',1],['b',2],['c',3]]), 3, 'map has size of 3');
|
|
1667
1589
|
*
|
|
1668
1590
|
* @name lengthOf
|
|
1669
|
-
* @param {
|
|
1670
|
-
* @param {
|
|
1671
|
-
* @param {
|
|
1591
|
+
* @param {unknown} exp
|
|
1592
|
+
* @param {number} len
|
|
1593
|
+
* @param {string} msg
|
|
1672
1594
|
* @namespace Assert
|
|
1673
|
-
* @
|
|
1595
|
+
* @public
|
|
1674
1596
|
*/
|
|
1675
|
-
|
|
1676
1597
|
assert.lengthOf = function (exp, len, msg) {
|
|
1677
1598
|
new Assertion(exp, msg, assert.lengthOf, true).to.have.lengthOf(len);
|
|
1678
1599
|
};
|
|
@@ -1690,13 +1611,12 @@ assert.lengthOf = function (exp, len, msg) {
|
|
|
1690
1611
|
* assert.hasAnyKeys(new Set([{foo: 'bar'}, 'anotherKey']), [{foo: 'bar'}, 'anotherKey']);
|
|
1691
1612
|
*
|
|
1692
1613
|
* @name hasAnyKeys
|
|
1693
|
-
* @param {
|
|
1694
|
-
* @param {Array|
|
|
1695
|
-
* @param {
|
|
1614
|
+
* @param {unknown} obj
|
|
1615
|
+
* @param {Array | object} keys
|
|
1616
|
+
* @param {string} msg
|
|
1696
1617
|
* @namespace Assert
|
|
1697
|
-
* @
|
|
1618
|
+
* @public
|
|
1698
1619
|
*/
|
|
1699
|
-
|
|
1700
1620
|
assert.hasAnyKeys = function (obj, keys, msg) {
|
|
1701
1621
|
new Assertion(obj, msg, assert.hasAnyKeys, true).to.have.any.keys(keys);
|
|
1702
1622
|
}
|
|
@@ -1711,16 +1631,15 @@ assert.hasAnyKeys = function (obj, keys, msg) {
|
|
|
1711
1631
|
* assert.hasAllKeys({foo: 1, bar: 2, baz: 3}, ['foo', 'bar', 'baz']);
|
|
1712
1632
|
* assert.hasAllKeys({foo: 1, bar: 2, baz: 3}, {foo: 30, bar: 99, baz: 1337]);
|
|
1713
1633
|
* assert.hasAllKeys(new Map([[{foo: 1}, 'bar'], ['key', 'value']]), [{foo: 1}, 'key']);
|
|
1714
|
-
* assert.hasAllKeys(new Set([{foo: 'bar'}, 'anotherKey'], [{foo: 'bar'}, 'anotherKey']);
|
|
1634
|
+
* assert.hasAllKeys(new Set([{foo: 'bar'}, 'anotherKey']), [{foo: 'bar'}, 'anotherKey']);
|
|
1715
1635
|
*
|
|
1716
1636
|
* @name hasAllKeys
|
|
1717
|
-
* @param {
|
|
1718
|
-
* @param {
|
|
1719
|
-
* @param {
|
|
1637
|
+
* @param {unknown} obj
|
|
1638
|
+
* @param {string[]} keys
|
|
1639
|
+
* @param {string} msg
|
|
1720
1640
|
* @namespace Assert
|
|
1721
|
-
* @
|
|
1641
|
+
* @public
|
|
1722
1642
|
*/
|
|
1723
|
-
|
|
1724
1643
|
assert.hasAllKeys = function (obj, keys, msg) {
|
|
1725
1644
|
new Assertion(obj, msg, assert.hasAllKeys, true).to.have.all.keys(keys);
|
|
1726
1645
|
}
|
|
@@ -1738,17 +1657,16 @@ assert.hasAllKeys = function (obj, keys, msg) {
|
|
|
1738
1657
|
* assert.containsAllKeys({foo: 1, bar: 2, baz: 3}, {foo: 30, bar: 99, baz: 1337});
|
|
1739
1658
|
* assert.containsAllKeys(new Map([[{foo: 1}, 'bar'], ['key', 'value']]), [{foo: 1}]);
|
|
1740
1659
|
* assert.containsAllKeys(new Map([[{foo: 1}, 'bar'], ['key', 'value']]), [{foo: 1}, 'key']);
|
|
1741
|
-
* assert.containsAllKeys(new Set([{foo: 'bar'}, 'anotherKey'], [{foo: 'bar'}]);
|
|
1742
|
-
* assert.containsAllKeys(new Set([{foo: 'bar'}, 'anotherKey'], [{foo: 'bar'}, 'anotherKey']);
|
|
1660
|
+
* assert.containsAllKeys(new Set([{foo: 'bar'}, 'anotherKey']), [{foo: 'bar'}]);
|
|
1661
|
+
* assert.containsAllKeys(new Set([{foo: 'bar'}, 'anotherKey']), [{foo: 'bar'}, 'anotherKey']);
|
|
1743
1662
|
*
|
|
1744
1663
|
* @name containsAllKeys
|
|
1745
|
-
* @param {
|
|
1746
|
-
* @param {
|
|
1747
|
-
* @param {
|
|
1664
|
+
* @param {unknown} obj
|
|
1665
|
+
* @param {string[]} keys
|
|
1666
|
+
* @param {string} msg
|
|
1748
1667
|
* @namespace Assert
|
|
1749
|
-
* @
|
|
1668
|
+
* @public
|
|
1750
1669
|
*/
|
|
1751
|
-
|
|
1752
1670
|
assert.containsAllKeys = function (obj, keys, msg) {
|
|
1753
1671
|
new Assertion(obj, msg, assert.containsAllKeys, true)
|
|
1754
1672
|
.to.contain.all.keys(keys);
|
|
@@ -1764,16 +1682,15 @@ assert.containsAllKeys = function (obj, keys, msg) {
|
|
|
1764
1682
|
* assert.doesNotHaveAnyKeys({foo: 1, bar: 2, baz: 3}, ['one', 'two', 'example']);
|
|
1765
1683
|
* assert.doesNotHaveAnyKeys({foo: 1, bar: 2, baz: 3}, {one: 1, two: 2, example: 'foo'});
|
|
1766
1684
|
* assert.doesNotHaveAnyKeys(new Map([[{foo: 1}, 'bar'], ['key', 'value']]), [{one: 'two'}, 'example']);
|
|
1767
|
-
* assert.doesNotHaveAnyKeys(new Set([{foo: 'bar'}, 'anotherKey'], [{one: 'two'}, 'example']);
|
|
1685
|
+
* assert.doesNotHaveAnyKeys(new Set([{foo: 'bar'}, 'anotherKey']), [{one: 'two'}, 'example']);
|
|
1768
1686
|
*
|
|
1769
1687
|
* @name doesNotHaveAnyKeys
|
|
1770
|
-
* @param {
|
|
1771
|
-
* @param {
|
|
1772
|
-
* @param {
|
|
1688
|
+
* @param {unknown} obj
|
|
1689
|
+
* @param {string[]} keys
|
|
1690
|
+
* @param {string} msg
|
|
1773
1691
|
* @namespace Assert
|
|
1774
|
-
* @
|
|
1692
|
+
* @public
|
|
1775
1693
|
*/
|
|
1776
|
-
|
|
1777
1694
|
assert.doesNotHaveAnyKeys = function (obj, keys, msg) {
|
|
1778
1695
|
new Assertion(obj, msg, assert.doesNotHaveAnyKeys, true)
|
|
1779
1696
|
.to.not.have.any.keys(keys);
|
|
@@ -1789,16 +1706,15 @@ assert.doesNotHaveAnyKeys = function (obj, keys, msg) {
|
|
|
1789
1706
|
* assert.doesNotHaveAllKeys({foo: 1, bar: 2, baz: 3}, ['one', 'two', 'example']);
|
|
1790
1707
|
* assert.doesNotHaveAllKeys({foo: 1, bar: 2, baz: 3}, {one: 1, two: 2, example: 'foo'});
|
|
1791
1708
|
* assert.doesNotHaveAllKeys(new Map([[{foo: 1}, 'bar'], ['key', 'value']]), [{one: 'two'}, 'example']);
|
|
1792
|
-
* assert.doesNotHaveAllKeys(new Set([{foo: 'bar'}, 'anotherKey'], [{one: 'two'}, 'example']);
|
|
1709
|
+
* assert.doesNotHaveAllKeys(new Set([{foo: 'bar'}, 'anotherKey']), [{one: 'two'}, 'example']);
|
|
1793
1710
|
*
|
|
1794
1711
|
* @name doesNotHaveAllKeys
|
|
1795
|
-
* @param {
|
|
1796
|
-
* @param {
|
|
1797
|
-
* @param {
|
|
1712
|
+
* @param {unknown} obj
|
|
1713
|
+
* @param {string[]} keys
|
|
1714
|
+
* @param {string} msg
|
|
1798
1715
|
* @namespace Assert
|
|
1799
|
-
* @
|
|
1716
|
+
* @public
|
|
1800
1717
|
*/
|
|
1801
|
-
|
|
1802
1718
|
assert.doesNotHaveAllKeys = function (obj, keys, msg) {
|
|
1803
1719
|
new Assertion(obj, msg, assert.doesNotHaveAllKeys, true)
|
|
1804
1720
|
.to.not.have.all.keys(keys);
|
|
@@ -1821,13 +1737,12 @@ assert.doesNotHaveAllKeys = function (obj, keys, msg) {
|
|
|
1821
1737
|
* assert.hasAnyDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {two: 'two'}]);
|
|
1822
1738
|
*
|
|
1823
1739
|
* @name hasAnyDeepKeys
|
|
1824
|
-
* @param {
|
|
1825
|
-
* @param {Array|
|
|
1826
|
-
* @param {
|
|
1740
|
+
* @param {unknown} obj
|
|
1741
|
+
* @param {Array | object} keys
|
|
1742
|
+
* @param {string} msg
|
|
1827
1743
|
* @namespace Assert
|
|
1828
|
-
* @
|
|
1744
|
+
* @public
|
|
1829
1745
|
*/
|
|
1830
|
-
|
|
1831
1746
|
assert.hasAnyDeepKeys = function (obj, keys, msg) {
|
|
1832
1747
|
new Assertion(obj, msg, assert.hasAnyDeepKeys, true)
|
|
1833
1748
|
.to.have.any.deep.keys(keys);
|
|
@@ -1848,13 +1763,12 @@ assert.hasAnyDeepKeys = function (obj, keys, msg) {
|
|
|
1848
1763
|
* assert.hasAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {two: 'two'}]);
|
|
1849
1764
|
*
|
|
1850
1765
|
* @name hasAllDeepKeys
|
|
1851
|
-
* @param {
|
|
1852
|
-
* @param {Array|
|
|
1853
|
-
* @param {
|
|
1766
|
+
* @param {unknown} obj
|
|
1767
|
+
* @param {Array | object} keys
|
|
1768
|
+
* @param {string} msg
|
|
1854
1769
|
* @namespace Assert
|
|
1855
|
-
* @
|
|
1770
|
+
* @public
|
|
1856
1771
|
*/
|
|
1857
|
-
|
|
1858
1772
|
assert.hasAllDeepKeys = function (obj, keys, msg) {
|
|
1859
1773
|
new Assertion(obj, msg, assert.hasAllDeepKeys, true)
|
|
1860
1774
|
.to.have.all.deep.keys(keys);
|
|
@@ -1875,13 +1789,12 @@ assert.hasAllDeepKeys = function (obj, keys, msg) {
|
|
|
1875
1789
|
* assert.containsAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {two: 'two'}]);
|
|
1876
1790
|
*
|
|
1877
1791
|
* @name containsAllDeepKeys
|
|
1878
|
-
* @param {
|
|
1879
|
-
* @param {Array|
|
|
1880
|
-
* @param {
|
|
1792
|
+
* @param {unknown} obj
|
|
1793
|
+
* @param {Array | object} keys
|
|
1794
|
+
* @param {string} msg
|
|
1881
1795
|
* @namespace Assert
|
|
1882
|
-
* @
|
|
1796
|
+
* @public
|
|
1883
1797
|
*/
|
|
1884
|
-
|
|
1885
1798
|
assert.containsAllDeepKeys = function (obj, keys, msg) {
|
|
1886
1799
|
new Assertion(obj, msg, assert.containsAllDeepKeys, true)
|
|
1887
1800
|
.to.contain.all.deep.keys(keys);
|
|
@@ -1902,13 +1815,12 @@ assert.containsAllDeepKeys = function (obj, keys, msg) {
|
|
|
1902
1815
|
* assert.doesNotHaveAnyDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{twenty: 'twenty'}, {fifty: 'fifty'}]);
|
|
1903
1816
|
*
|
|
1904
1817
|
* @name doesNotHaveAnyDeepKeys
|
|
1905
|
-
* @param {
|
|
1906
|
-
* @param {Array|
|
|
1907
|
-
* @param {
|
|
1818
|
+
* @param {unknown} obj
|
|
1819
|
+
* @param {Array | object} keys
|
|
1820
|
+
* @param {string} msg
|
|
1908
1821
|
* @namespace Assert
|
|
1909
|
-
* @
|
|
1822
|
+
* @public
|
|
1910
1823
|
*/
|
|
1911
|
-
|
|
1912
1824
|
assert.doesNotHaveAnyDeepKeys = function (obj, keys, msg) {
|
|
1913
1825
|
new Assertion(obj, msg, assert.doesNotHaveAnyDeepKeys, true)
|
|
1914
1826
|
.to.not.have.any.deep.keys(keys);
|
|
@@ -1929,13 +1841,12 @@ assert.doesNotHaveAnyDeepKeys = function (obj, keys, msg) {
|
|
|
1929
1841
|
* assert.doesNotHaveAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {fifty: 'fifty'}]);
|
|
1930
1842
|
*
|
|
1931
1843
|
* @name doesNotHaveAllDeepKeys
|
|
1932
|
-
* @param {
|
|
1933
|
-
* @param {Array|
|
|
1934
|
-
* @param {
|
|
1844
|
+
* @param {unknown} obj
|
|
1845
|
+
* @param {Array | object} keys
|
|
1846
|
+
* @param {string} msg
|
|
1935
1847
|
* @namespace Assert
|
|
1936
|
-
* @
|
|
1848
|
+
* @public
|
|
1937
1849
|
*/
|
|
1938
|
-
|
|
1939
1850
|
assert.doesNotHaveAllDeepKeys = function (obj, keys, msg) {
|
|
1940
1851
|
new Assertion(obj, msg, assert.doesNotHaveAllDeepKeys, true)
|
|
1941
1852
|
.to.not.have.all.deep.keys(keys);
|
|
@@ -1964,14 +1875,14 @@ assert.doesNotHaveAllDeepKeys = function (obj, keys, msg) {
|
|
|
1964
1875
|
* @alias throw
|
|
1965
1876
|
* @alias Throw
|
|
1966
1877
|
* @param {Function} fn
|
|
1967
|
-
* @param {
|
|
1968
|
-
* @param {RegExp|
|
|
1969
|
-
* @param {
|
|
1878
|
+
* @param {Error} errorLike
|
|
1879
|
+
* @param {RegExp | string} errMsgMatcher
|
|
1880
|
+
* @param {string} msg
|
|
1881
|
+
* @returns {unknown}
|
|
1970
1882
|
* @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
|
|
1971
1883
|
* @namespace Assert
|
|
1972
|
-
* @
|
|
1884
|
+
* @public
|
|
1973
1885
|
*/
|
|
1974
|
-
|
|
1975
1886
|
assert.throws = function (fn, errorLike, errMsgMatcher, msg) {
|
|
1976
1887
|
if ('string' === typeof errorLike || errorLike instanceof RegExp) {
|
|
1977
1888
|
errMsgMatcher = errorLike;
|
|
@@ -2004,21 +1915,20 @@ assert.throws = function (fn, errorLike, errMsgMatcher, msg) {
|
|
|
2004
1915
|
*
|
|
2005
1916
|
* @name doesNotThrow
|
|
2006
1917
|
* @param {Function} fn
|
|
2007
|
-
* @param {
|
|
2008
|
-
* @param {RegExp|
|
|
2009
|
-
* @param {
|
|
1918
|
+
* @param {Error} errorLike
|
|
1919
|
+
* @param {RegExp | string} errMsgMatcher
|
|
1920
|
+
* @param {string} message
|
|
2010
1921
|
* @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
|
|
2011
1922
|
* @namespace Assert
|
|
2012
|
-
* @
|
|
1923
|
+
* @public
|
|
2013
1924
|
*/
|
|
2014
|
-
|
|
2015
|
-
assert.doesNotThrow = function (fn, errorLike, errMsgMatcher, msg) {
|
|
1925
|
+
assert.doesNotThrow = function (fn, errorLike, errMsgMatcher, message) {
|
|
2016
1926
|
if ('string' === typeof errorLike || errorLike instanceof RegExp) {
|
|
2017
1927
|
errMsgMatcher = errorLike;
|
|
2018
1928
|
errorLike = null;
|
|
2019
1929
|
}
|
|
2020
1930
|
|
|
2021
|
-
new Assertion(fn,
|
|
1931
|
+
new Assertion(fn, message, assert.doesNotThrow, true)
|
|
2022
1932
|
.to.not.throw(errorLike, errMsgMatcher);
|
|
2023
1933
|
};
|
|
2024
1934
|
|
|
@@ -2031,14 +1941,13 @@ assert.doesNotThrow = function (fn, errorLike, errMsgMatcher, msg) {
|
|
|
2031
1941
|
* assert.operator(1, '>', 2, 'this will fail');
|
|
2032
1942
|
*
|
|
2033
1943
|
* @name operator
|
|
2034
|
-
* @param {
|
|
2035
|
-
* @param {
|
|
2036
|
-
* @param {
|
|
2037
|
-
* @param {
|
|
1944
|
+
* @param {unknown} val
|
|
1945
|
+
* @param {string} operator
|
|
1946
|
+
* @param {unknown} val2
|
|
1947
|
+
* @param {string} msg
|
|
2038
1948
|
* @namespace Assert
|
|
2039
|
-
* @
|
|
1949
|
+
* @public
|
|
2040
1950
|
*/
|
|
2041
|
-
|
|
2042
1951
|
assert.operator = function (val, operator, val2, msg) {
|
|
2043
1952
|
var ok;
|
|
2044
1953
|
switch(operator) {
|
|
@@ -2089,14 +1998,13 @@ assert.operator = function (val, operator, val2, msg) {
|
|
|
2089
1998
|
* assert.closeTo(1.5, 1, 0.5, 'numbers are close');
|
|
2090
1999
|
*
|
|
2091
2000
|
* @name closeTo
|
|
2092
|
-
* @param {
|
|
2093
|
-
* @param {
|
|
2094
|
-
* @param {
|
|
2095
|
-
* @param {
|
|
2001
|
+
* @param {number} act
|
|
2002
|
+
* @param {number} exp
|
|
2003
|
+
* @param {number} delta
|
|
2004
|
+
* @param {string} msg
|
|
2096
2005
|
* @namespace Assert
|
|
2097
|
-
* @
|
|
2006
|
+
* @public
|
|
2098
2007
|
*/
|
|
2099
|
-
|
|
2100
2008
|
assert.closeTo = function (act, exp, delta, msg) {
|
|
2101
2009
|
new Assertion(act, msg, assert.closeTo, true).to.be.closeTo(exp, delta);
|
|
2102
2010
|
};
|
|
@@ -2109,14 +2017,13 @@ assert.closeTo = function (act, exp, delta, msg) {
|
|
|
2109
2017
|
* assert.approximately(1.5, 1, 0.5, 'numbers are close');
|
|
2110
2018
|
*
|
|
2111
2019
|
* @name approximately
|
|
2112
|
-
* @param {
|
|
2113
|
-
* @param {
|
|
2114
|
-
* @param {
|
|
2115
|
-
* @param {
|
|
2020
|
+
* @param {number} act
|
|
2021
|
+
* @param {number} exp
|
|
2022
|
+
* @param {number} delta
|
|
2023
|
+
* @param {string} msg
|
|
2116
2024
|
* @namespace Assert
|
|
2117
|
-
* @
|
|
2025
|
+
* @public
|
|
2118
2026
|
*/
|
|
2119
|
-
|
|
2120
2027
|
assert.approximately = function (act, exp, delta, msg) {
|
|
2121
2028
|
new Assertion(act, msg, assert.approximately, true)
|
|
2122
2029
|
.to.be.approximately(exp, delta);
|
|
@@ -2133,11 +2040,10 @@ assert.approximately = function (act, exp, delta, msg) {
|
|
|
2133
2040
|
* @name sameMembers
|
|
2134
2041
|
* @param {Array} set1
|
|
2135
2042
|
* @param {Array} set2
|
|
2136
|
-
* @param {
|
|
2043
|
+
* @param {string} msg
|
|
2137
2044
|
* @namespace Assert
|
|
2138
|
-
* @
|
|
2045
|
+
* @public
|
|
2139
2046
|
*/
|
|
2140
|
-
|
|
2141
2047
|
assert.sameMembers = function (set1, set2, msg) {
|
|
2142
2048
|
new Assertion(set1, msg, assert.sameMembers, true)
|
|
2143
2049
|
.to.have.same.members(set2);
|
|
@@ -2154,11 +2060,10 @@ assert.sameMembers = function (set1, set2, msg) {
|
|
|
2154
2060
|
* @name notSameMembers
|
|
2155
2061
|
* @param {Array} set1
|
|
2156
2062
|
* @param {Array} set2
|
|
2157
|
-
* @param {
|
|
2063
|
+
* @param {string} msg
|
|
2158
2064
|
* @namespace Assert
|
|
2159
|
-
* @
|
|
2065
|
+
* @public
|
|
2160
2066
|
*/
|
|
2161
|
-
|
|
2162
2067
|
assert.notSameMembers = function (set1, set2, msg) {
|
|
2163
2068
|
new Assertion(set1, msg, assert.notSameMembers, true)
|
|
2164
2069
|
.to.not.have.same.members(set2);
|
|
@@ -2175,11 +2080,10 @@ assert.notSameMembers = function (set1, set2, msg) {
|
|
|
2175
2080
|
* @name sameDeepMembers
|
|
2176
2081
|
* @param {Array} set1
|
|
2177
2082
|
* @param {Array} set2
|
|
2178
|
-
* @param {
|
|
2083
|
+
* @param {string} msg
|
|
2179
2084
|
* @namespace Assert
|
|
2180
|
-
* @
|
|
2085
|
+
* @public
|
|
2181
2086
|
*/
|
|
2182
|
-
|
|
2183
2087
|
assert.sameDeepMembers = function (set1, set2, msg) {
|
|
2184
2088
|
new Assertion(set1, msg, assert.sameDeepMembers, true)
|
|
2185
2089
|
.to.have.same.deep.members(set2);
|
|
@@ -2196,11 +2100,10 @@ assert.sameDeepMembers = function (set1, set2, msg) {
|
|
|
2196
2100
|
* @name notSameDeepMembers
|
|
2197
2101
|
* @param {Array} set1
|
|
2198
2102
|
* @param {Array} set2
|
|
2199
|
-
* @param {
|
|
2103
|
+
* @param {string} msg
|
|
2200
2104
|
* @namespace Assert
|
|
2201
|
-
* @
|
|
2105
|
+
* @public
|
|
2202
2106
|
*/
|
|
2203
|
-
|
|
2204
2107
|
assert.notSameDeepMembers = function (set1, set2, msg) {
|
|
2205
2108
|
new Assertion(set1, msg, assert.notSameDeepMembers, true)
|
|
2206
2109
|
.to.not.have.same.deep.members(set2);
|
|
@@ -2217,11 +2120,10 @@ assert.notSameDeepMembers = function (set1, set2, msg) {
|
|
|
2217
2120
|
* @name sameOrderedMembers
|
|
2218
2121
|
* @param {Array} set1
|
|
2219
2122
|
* @param {Array} set2
|
|
2220
|
-
* @param {
|
|
2123
|
+
* @param {string} msg
|
|
2221
2124
|
* @namespace Assert
|
|
2222
|
-
* @
|
|
2125
|
+
* @public
|
|
2223
2126
|
*/
|
|
2224
|
-
|
|
2225
2127
|
assert.sameOrderedMembers = function (set1, set2, msg) {
|
|
2226
2128
|
new Assertion(set1, msg, assert.sameOrderedMembers, true)
|
|
2227
2129
|
.to.have.same.ordered.members(set2);
|
|
@@ -2238,11 +2140,10 @@ assert.sameOrderedMembers = function (set1, set2, msg) {
|
|
|
2238
2140
|
* @name notSameOrderedMembers
|
|
2239
2141
|
* @param {Array} set1
|
|
2240
2142
|
* @param {Array} set2
|
|
2241
|
-
* @param {
|
|
2143
|
+
* @param {string} msg
|
|
2242
2144
|
* @namespace Assert
|
|
2243
|
-
* @
|
|
2145
|
+
* @public
|
|
2244
2146
|
*/
|
|
2245
|
-
|
|
2246
2147
|
assert.notSameOrderedMembers = function (set1, set2, msg) {
|
|
2247
2148
|
new Assertion(set1, msg, assert.notSameOrderedMembers, true)
|
|
2248
2149
|
.to.not.have.same.ordered.members(set2);
|
|
@@ -2259,11 +2160,10 @@ assert.notSameOrderedMembers = function (set1, set2, msg) {
|
|
|
2259
2160
|
* @name sameDeepOrderedMembers
|
|
2260
2161
|
* @param {Array} set1
|
|
2261
2162
|
* @param {Array} set2
|
|
2262
|
-
* @param {
|
|
2163
|
+
* @param {string} msg
|
|
2263
2164
|
* @namespace Assert
|
|
2264
|
-
* @
|
|
2165
|
+
* @public
|
|
2265
2166
|
*/
|
|
2266
|
-
|
|
2267
2167
|
assert.sameDeepOrderedMembers = function (set1, set2, msg) {
|
|
2268
2168
|
new Assertion(set1, msg, assert.sameDeepOrderedMembers, true)
|
|
2269
2169
|
.to.have.same.deep.ordered.members(set2);
|
|
@@ -2281,11 +2181,10 @@ assert.sameDeepOrderedMembers = function (set1, set2, msg) {
|
|
|
2281
2181
|
* @name notSameDeepOrderedMembers
|
|
2282
2182
|
* @param {Array} set1
|
|
2283
2183
|
* @param {Array} set2
|
|
2284
|
-
* @param {
|
|
2184
|
+
* @param {string} msg
|
|
2285
2185
|
* @namespace Assert
|
|
2286
|
-
* @
|
|
2186
|
+
* @public
|
|
2287
2187
|
*/
|
|
2288
|
-
|
|
2289
2188
|
assert.notSameDeepOrderedMembers = function (set1, set2, msg) {
|
|
2290
2189
|
new Assertion(set1, msg, assert.notSameDeepOrderedMembers, true)
|
|
2291
2190
|
.to.not.have.same.deep.ordered.members(set2);
|
|
@@ -2302,11 +2201,10 @@ assert.notSameDeepOrderedMembers = function (set1, set2, msg) {
|
|
|
2302
2201
|
* @name includeMembers
|
|
2303
2202
|
* @param {Array} superset
|
|
2304
2203
|
* @param {Array} subset
|
|
2305
|
-
* @param {
|
|
2204
|
+
* @param {string} msg
|
|
2306
2205
|
* @namespace Assert
|
|
2307
|
-
* @
|
|
2206
|
+
* @public
|
|
2308
2207
|
*/
|
|
2309
|
-
|
|
2310
2208
|
assert.includeMembers = function (superset, subset, msg) {
|
|
2311
2209
|
new Assertion(superset, msg, assert.includeMembers, true)
|
|
2312
2210
|
.to.include.members(subset);
|
|
@@ -2323,11 +2221,10 @@ assert.includeMembers = function (superset, subset, msg) {
|
|
|
2323
2221
|
* @name notIncludeMembers
|
|
2324
2222
|
* @param {Array} superset
|
|
2325
2223
|
* @param {Array} subset
|
|
2326
|
-
* @param {
|
|
2224
|
+
* @param {string} msg
|
|
2327
2225
|
* @namespace Assert
|
|
2328
|
-
* @
|
|
2226
|
+
* @public
|
|
2329
2227
|
*/
|
|
2330
|
-
|
|
2331
2228
|
assert.notIncludeMembers = function (superset, subset, msg) {
|
|
2332
2229
|
new Assertion(superset, msg, assert.notIncludeMembers, true)
|
|
2333
2230
|
.to.not.include.members(subset);
|
|
@@ -2344,11 +2241,10 @@ assert.notIncludeMembers = function (superset, subset, msg) {
|
|
|
2344
2241
|
* @name includeDeepMembers
|
|
2345
2242
|
* @param {Array} superset
|
|
2346
2243
|
* @param {Array} subset
|
|
2347
|
-
* @param {
|
|
2244
|
+
* @param {string} msg
|
|
2348
2245
|
* @namespace Assert
|
|
2349
|
-
* @
|
|
2246
|
+
* @public
|
|
2350
2247
|
*/
|
|
2351
|
-
|
|
2352
2248
|
assert.includeDeepMembers = function (superset, subset, msg) {
|
|
2353
2249
|
new Assertion(superset, msg, assert.includeDeepMembers, true)
|
|
2354
2250
|
.to.include.deep.members(subset);
|
|
@@ -2365,11 +2261,10 @@ assert.includeDeepMembers = function (superset, subset, msg) {
|
|
|
2365
2261
|
* @name notIncludeDeepMembers
|
|
2366
2262
|
* @param {Array} superset
|
|
2367
2263
|
* @param {Array} subset
|
|
2368
|
-
* @param {
|
|
2264
|
+
* @param {string} msg
|
|
2369
2265
|
* @namespace Assert
|
|
2370
|
-
* @
|
|
2266
|
+
* @public
|
|
2371
2267
|
*/
|
|
2372
|
-
|
|
2373
2268
|
assert.notIncludeDeepMembers = function (superset, subset, msg) {
|
|
2374
2269
|
new Assertion(superset, msg, assert.notIncludeDeepMembers, true)
|
|
2375
2270
|
.to.not.include.deep.members(subset);
|
|
@@ -2387,11 +2282,10 @@ assert.notIncludeDeepMembers = function (superset, subset, msg) {
|
|
|
2387
2282
|
* @name includeOrderedMembers
|
|
2388
2283
|
* @param {Array} superset
|
|
2389
2284
|
* @param {Array} subset
|
|
2390
|
-
* @param {
|
|
2285
|
+
* @param {string} msg
|
|
2391
2286
|
* @namespace Assert
|
|
2392
|
-
* @
|
|
2287
|
+
* @public
|
|
2393
2288
|
*/
|
|
2394
|
-
|
|
2395
2289
|
assert.includeOrderedMembers = function (superset, subset, msg) {
|
|
2396
2290
|
new Assertion(superset, msg, assert.includeOrderedMembers, true)
|
|
2397
2291
|
.to.include.ordered.members(subset);
|
|
@@ -2410,11 +2304,10 @@ assert.includeOrderedMembers = function (superset, subset, msg) {
|
|
|
2410
2304
|
* @name notIncludeOrderedMembers
|
|
2411
2305
|
* @param {Array} superset
|
|
2412
2306
|
* @param {Array} subset
|
|
2413
|
-
* @param {
|
|
2307
|
+
* @param {string} msg
|
|
2414
2308
|
* @namespace Assert
|
|
2415
|
-
* @
|
|
2309
|
+
* @public
|
|
2416
2310
|
*/
|
|
2417
|
-
|
|
2418
2311
|
assert.notIncludeOrderedMembers = function (superset, subset, msg) {
|
|
2419
2312
|
new Assertion(superset, msg, assert.notIncludeOrderedMembers, true)
|
|
2420
2313
|
.to.not.include.ordered.members(subset);
|
|
@@ -2432,11 +2325,10 @@ assert.notIncludeOrderedMembers = function (superset, subset, msg) {
|
|
|
2432
2325
|
* @name includeDeepOrderedMembers
|
|
2433
2326
|
* @param {Array} superset
|
|
2434
2327
|
* @param {Array} subset
|
|
2435
|
-
* @param {
|
|
2328
|
+
* @param {string} msg
|
|
2436
2329
|
* @namespace Assert
|
|
2437
|
-
* @
|
|
2330
|
+
* @public
|
|
2438
2331
|
*/
|
|
2439
|
-
|
|
2440
2332
|
assert.includeDeepOrderedMembers = function (superset, subset, msg) {
|
|
2441
2333
|
new Assertion(superset, msg, assert.includeDeepOrderedMembers, true)
|
|
2442
2334
|
.to.include.deep.ordered.members(subset);
|
|
@@ -2456,11 +2348,10 @@ assert.includeDeepOrderedMembers = function (superset, subset, msg) {
|
|
|
2456
2348
|
* @name notIncludeDeepOrderedMembers
|
|
2457
2349
|
* @param {Array} superset
|
|
2458
2350
|
* @param {Array} subset
|
|
2459
|
-
* @param {
|
|
2351
|
+
* @param {string} msg
|
|
2460
2352
|
* @namespace Assert
|
|
2461
|
-
* @
|
|
2353
|
+
* @public
|
|
2462
2354
|
*/
|
|
2463
|
-
|
|
2464
2355
|
assert.notIncludeDeepOrderedMembers = function (superset, subset, msg) {
|
|
2465
2356
|
new Assertion(superset, msg, assert.notIncludeDeepOrderedMembers, true)
|
|
2466
2357
|
.to.not.include.deep.ordered.members(subset);
|
|
@@ -2476,15 +2367,41 @@ assert.notIncludeDeepOrderedMembers = function (superset, subset, msg) {
|
|
|
2476
2367
|
* @name oneOf
|
|
2477
2368
|
* @param {*} inList
|
|
2478
2369
|
* @param {Array<*>} list
|
|
2479
|
-
* @param {
|
|
2370
|
+
* @param {string} msg
|
|
2480
2371
|
* @namespace Assert
|
|
2481
|
-
* @
|
|
2372
|
+
* @public
|
|
2482
2373
|
*/
|
|
2483
|
-
|
|
2484
2374
|
assert.oneOf = function (inList, list, msg) {
|
|
2485
2375
|
new Assertion(inList, msg, assert.oneOf, true).to.be.oneOf(list);
|
|
2486
2376
|
}
|
|
2487
2377
|
|
|
2378
|
+
/**
|
|
2379
|
+
* ### isIterable(obj, [message])
|
|
2380
|
+
*
|
|
2381
|
+
* Asserts that the target is an iterable, which means that it has a iterator
|
|
2382
|
+
* with the exception of `String.`
|
|
2383
|
+
*
|
|
2384
|
+
* assert.isIterable([1, 2]);
|
|
2385
|
+
*
|
|
2386
|
+
* @param {unknown} obj
|
|
2387
|
+
* @param {string} [msg]
|
|
2388
|
+
* @namespace Assert
|
|
2389
|
+
* @public
|
|
2390
|
+
*/
|
|
2391
|
+
assert.isIterable = function(obj, msg) {
|
|
2392
|
+
if (obj == undefined || !obj[Symbol.iterator]) {
|
|
2393
|
+
msg = msg ?
|
|
2394
|
+
`${msg} expected ${inspect(obj)} to be an iterable` :
|
|
2395
|
+
`expected ${inspect(obj)} to be an iterable`;
|
|
2396
|
+
|
|
2397
|
+
throw new AssertionError(
|
|
2398
|
+
msg,
|
|
2399
|
+
undefined,
|
|
2400
|
+
assert.isIterable
|
|
2401
|
+
);
|
|
2402
|
+
}
|
|
2403
|
+
}
|
|
2404
|
+
|
|
2488
2405
|
/**
|
|
2489
2406
|
* ### .changes(function, object, property, [message])
|
|
2490
2407
|
*
|
|
@@ -2495,14 +2412,13 @@ assert.oneOf = function (inList, list, msg) {
|
|
|
2495
2412
|
* assert.changes(fn, obj, 'val');
|
|
2496
2413
|
*
|
|
2497
2414
|
* @name changes
|
|
2498
|
-
* @param {Function} modifier function
|
|
2499
|
-
* @param {
|
|
2500
|
-
* @param {
|
|
2501
|
-
* @param {
|
|
2415
|
+
* @param {Function} fn modifier function
|
|
2416
|
+
* @param {object} obj object or getter function
|
|
2417
|
+
* @param {string} prop property name _optional_
|
|
2418
|
+
* @param {string} msg _optional_
|
|
2502
2419
|
* @namespace Assert
|
|
2503
|
-
* @
|
|
2420
|
+
* @public
|
|
2504
2421
|
*/
|
|
2505
|
-
|
|
2506
2422
|
assert.changes = function (fn, obj, prop, msg) {
|
|
2507
2423
|
if (arguments.length === 3 && typeof obj === 'function') {
|
|
2508
2424
|
msg = prop;
|
|
@@ -2512,7 +2428,7 @@ assert.changes = function (fn, obj, prop, msg) {
|
|
|
2512
2428
|
new Assertion(fn, msg, assert.changes, true).to.change(obj, prop);
|
|
2513
2429
|
}
|
|
2514
2430
|
|
|
2515
|
-
|
|
2431
|
+
/**
|
|
2516
2432
|
* ### .changesBy(function, object, property, delta, [message])
|
|
2517
2433
|
*
|
|
2518
2434
|
* Asserts that a function changes the value of a property by an amount (delta).
|
|
@@ -2522,15 +2438,14 @@ assert.changes = function (fn, obj, prop, msg) {
|
|
|
2522
2438
|
* assert.changesBy(fn, obj, 'val', 2);
|
|
2523
2439
|
*
|
|
2524
2440
|
* @name changesBy
|
|
2525
|
-
* @param {Function} modifier function
|
|
2526
|
-
* @param {
|
|
2527
|
-
* @param {
|
|
2528
|
-
* @param {
|
|
2529
|
-
* @param {
|
|
2441
|
+
* @param {Function} fn modifier function
|
|
2442
|
+
* @param {object} obj object or getter function
|
|
2443
|
+
* @param {string} prop property name _optional_
|
|
2444
|
+
* @param {number} delta msg change amount (delta)
|
|
2445
|
+
* @param {string} msg _optional_
|
|
2530
2446
|
* @namespace Assert
|
|
2531
|
-
* @
|
|
2447
|
+
* @public
|
|
2532
2448
|
*/
|
|
2533
|
-
|
|
2534
2449
|
assert.changesBy = function (fn, obj, prop, delta, msg) {
|
|
2535
2450
|
if (arguments.length === 4 && typeof obj === 'function') {
|
|
2536
2451
|
var tmpMsg = delta;
|
|
@@ -2545,24 +2460,24 @@ assert.changesBy = function (fn, obj, prop, delta, msg) {
|
|
|
2545
2460
|
.to.change(obj, prop).by(delta);
|
|
2546
2461
|
}
|
|
2547
2462
|
|
|
2548
|
-
|
|
2463
|
+
/**
|
|
2549
2464
|
* ### .doesNotChange(function, object, property, [message])
|
|
2550
2465
|
*
|
|
2551
2466
|
* Asserts that a function does not change the value of a property.
|
|
2552
2467
|
*
|
|
2553
|
-
*
|
|
2554
|
-
*
|
|
2555
|
-
*
|
|
2468
|
+
* var obj = { val: 10 };
|
|
2469
|
+
* var fn = function() { console.log('foo'); };
|
|
2470
|
+
* assert.doesNotChange(fn, obj, 'val');
|
|
2556
2471
|
*
|
|
2557
2472
|
* @name doesNotChange
|
|
2558
|
-
* @param {Function} modifier function
|
|
2559
|
-
* @param {
|
|
2560
|
-
* @param {
|
|
2561
|
-
* @param {
|
|
2473
|
+
* @param {Function} fn modifier function
|
|
2474
|
+
* @param {object} obj object or getter function
|
|
2475
|
+
* @param {string} prop property name _optional_
|
|
2476
|
+
* @param {string} msg _optional_
|
|
2477
|
+
* @returns {unknown}
|
|
2562
2478
|
* @namespace Assert
|
|
2563
|
-
* @
|
|
2479
|
+
* @public
|
|
2564
2480
|
*/
|
|
2565
|
-
|
|
2566
2481
|
assert.doesNotChange = function (fn, obj, prop, msg) {
|
|
2567
2482
|
if (arguments.length === 3 && typeof obj === 'function') {
|
|
2568
2483
|
msg = prop;
|
|
@@ -2583,15 +2498,14 @@ assert.doesNotChange = function (fn, obj, prop, msg) {
|
|
|
2583
2498
|
* assert.changesButNotBy(fn, obj, 'val', 5);
|
|
2584
2499
|
*
|
|
2585
2500
|
* @name changesButNotBy
|
|
2586
|
-
* @param {Function} modifier function
|
|
2587
|
-
* @param {
|
|
2588
|
-
* @param {
|
|
2589
|
-
* @param {
|
|
2590
|
-
* @param {
|
|
2501
|
+
* @param {Function} fn - modifier function
|
|
2502
|
+
* @param {object} obj - object or getter function
|
|
2503
|
+
* @param {string} prop - property name _optional_
|
|
2504
|
+
* @param {number} delta - change amount (delta)
|
|
2505
|
+
* @param {string} msg - message _optional_
|
|
2591
2506
|
* @namespace Assert
|
|
2592
|
-
* @
|
|
2507
|
+
* @public
|
|
2593
2508
|
*/
|
|
2594
|
-
|
|
2595
2509
|
assert.changesButNotBy = function (fn, obj, prop, delta, msg) {
|
|
2596
2510
|
if (arguments.length === 4 && typeof obj === 'function') {
|
|
2597
2511
|
var tmpMsg = delta;
|
|
@@ -2615,15 +2529,15 @@ assert.changesButNotBy = function (fn, obj, prop, delta, msg) {
|
|
|
2615
2529
|
* var fn = function() { obj.val = 13 };
|
|
2616
2530
|
* assert.increases(fn, obj, 'val');
|
|
2617
2531
|
*
|
|
2618
|
-
* @
|
|
2619
|
-
* @param {Function} modifier function
|
|
2620
|
-
* @param {Object} object or getter function
|
|
2621
|
-
* @param {String} property name _optional_
|
|
2622
|
-
* @param {String} message _optional_
|
|
2532
|
+
* @public
|
|
2623
2533
|
* @namespace Assert
|
|
2624
|
-
* @
|
|
2534
|
+
* @name increases
|
|
2535
|
+
* @param {Function} fn - modifier function
|
|
2536
|
+
* @param {object} obj - object or getter function
|
|
2537
|
+
* @param {string} prop - property name _optional_
|
|
2538
|
+
* @param {string} msg - message _optional_
|
|
2539
|
+
* @returns {unknown}
|
|
2625
2540
|
*/
|
|
2626
|
-
|
|
2627
2541
|
assert.increases = function (fn, obj, prop, msg) {
|
|
2628
2542
|
if (arguments.length === 3 && typeof obj === 'function') {
|
|
2629
2543
|
msg = prop;
|
|
@@ -2643,16 +2557,15 @@ assert.increases = function (fn, obj, prop, msg) {
|
|
|
2643
2557
|
* var fn = function() { obj.val += 10 };
|
|
2644
2558
|
* assert.increasesBy(fn, obj, 'val', 10);
|
|
2645
2559
|
*
|
|
2560
|
+
* @public
|
|
2646
2561
|
* @name increasesBy
|
|
2647
|
-
* @param {Function} modifier function
|
|
2648
|
-
* @param {Object} object or getter function
|
|
2649
|
-
* @param {String} property name _optional_
|
|
2650
|
-
* @param {Number} change amount (delta)
|
|
2651
|
-
* @param {String} message _optional_
|
|
2652
2562
|
* @namespace Assert
|
|
2653
|
-
* @
|
|
2563
|
+
* @param {Function} fn - modifier function
|
|
2564
|
+
* @param {object} obj - object or getter function
|
|
2565
|
+
* @param {string} prop - property name _optional_
|
|
2566
|
+
* @param {number} delta - change amount (delta)
|
|
2567
|
+
* @param {string} msg - message _optional_
|
|
2654
2568
|
*/
|
|
2655
|
-
|
|
2656
2569
|
assert.increasesBy = function (fn, obj, prop, delta, msg) {
|
|
2657
2570
|
if (arguments.length === 4 && typeof obj === 'function') {
|
|
2658
2571
|
var tmpMsg = delta;
|
|
@@ -2677,14 +2590,14 @@ assert.increasesBy = function (fn, obj, prop, delta, msg) {
|
|
|
2677
2590
|
* assert.doesNotIncrease(fn, obj, 'val');
|
|
2678
2591
|
*
|
|
2679
2592
|
* @name doesNotIncrease
|
|
2680
|
-
* @param {Function} modifier function
|
|
2681
|
-
* @param {
|
|
2682
|
-
* @param {
|
|
2683
|
-
* @
|
|
2593
|
+
* @param {Function} fn modifier function
|
|
2594
|
+
* @param {object} obj object or getter function
|
|
2595
|
+
* @param {string} prop property name _optional_
|
|
2596
|
+
* @returns {Assertion}
|
|
2597
|
+
* @param {string} msg _optional_
|
|
2684
2598
|
* @namespace Assert
|
|
2685
|
-
* @
|
|
2599
|
+
* @public
|
|
2686
2600
|
*/
|
|
2687
|
-
|
|
2688
2601
|
assert.doesNotIncrease = function (fn, obj, prop, msg) {
|
|
2689
2602
|
if (arguments.length === 3 && typeof obj === 'function') {
|
|
2690
2603
|
msg = prop;
|
|
@@ -2705,15 +2618,14 @@ assert.doesNotIncrease = function (fn, obj, prop, msg) {
|
|
|
2705
2618
|
* assert.increasesButNotBy(fn, obj, 'val', 10);
|
|
2706
2619
|
*
|
|
2707
2620
|
* @name increasesButNotBy
|
|
2708
|
-
* @param {Function} modifier function
|
|
2709
|
-
* @param {
|
|
2710
|
-
* @param {
|
|
2711
|
-
* @param {
|
|
2712
|
-
* @param {
|
|
2621
|
+
* @param {Function} fn modifier function
|
|
2622
|
+
* @param {object} obj object or getter function
|
|
2623
|
+
* @param {string} prop property name _optional_
|
|
2624
|
+
* @param {number} delta change amount (delta)
|
|
2625
|
+
* @param {string} msg _optional_
|
|
2713
2626
|
* @namespace Assert
|
|
2714
|
-
* @
|
|
2627
|
+
* @public
|
|
2715
2628
|
*/
|
|
2716
|
-
|
|
2717
2629
|
assert.increasesButNotBy = function (fn, obj, prop, delta, msg) {
|
|
2718
2630
|
if (arguments.length === 4 && typeof obj === 'function') {
|
|
2719
2631
|
var tmpMsg = delta;
|
|
@@ -2738,14 +2650,14 @@ assert.increasesButNotBy = function (fn, obj, prop, delta, msg) {
|
|
|
2738
2650
|
* assert.decreases(fn, obj, 'val');
|
|
2739
2651
|
*
|
|
2740
2652
|
* @name decreases
|
|
2741
|
-
* @param {Function} modifier function
|
|
2742
|
-
* @param {
|
|
2743
|
-
* @param {
|
|
2744
|
-
* @
|
|
2653
|
+
* @param {Function} fn modifier function
|
|
2654
|
+
* @param {object} obj object or getter function
|
|
2655
|
+
* @param {string} prop property name _optional_
|
|
2656
|
+
* @returns {Assertion}
|
|
2657
|
+
* @param {string} msg _optional_
|
|
2745
2658
|
* @namespace Assert
|
|
2746
|
-
* @
|
|
2659
|
+
* @public
|
|
2747
2660
|
*/
|
|
2748
|
-
|
|
2749
2661
|
assert.decreases = function (fn, obj, prop, msg) {
|
|
2750
2662
|
if (arguments.length === 3 && typeof obj === 'function') {
|
|
2751
2663
|
msg = prop;
|
|
@@ -2766,15 +2678,14 @@ assert.decreases = function (fn, obj, prop, msg) {
|
|
|
2766
2678
|
* assert.decreasesBy(fn, obj, 'val', 5);
|
|
2767
2679
|
*
|
|
2768
2680
|
* @name decreasesBy
|
|
2769
|
-
* @param {Function} modifier function
|
|
2770
|
-
* @param {
|
|
2771
|
-
* @param {
|
|
2772
|
-
* @param {
|
|
2773
|
-
* @param {
|
|
2681
|
+
* @param {Function} fn modifier function
|
|
2682
|
+
* @param {object} obj object or getter function
|
|
2683
|
+
* @param {string} prop property name _optional_
|
|
2684
|
+
* @param {number} delta change amount (delta)
|
|
2685
|
+
* @param {string} msg _optional_
|
|
2774
2686
|
* @namespace Assert
|
|
2775
|
-
* @
|
|
2687
|
+
* @public
|
|
2776
2688
|
*/
|
|
2777
|
-
|
|
2778
2689
|
assert.decreasesBy = function (fn, obj, prop, delta, msg) {
|
|
2779
2690
|
if (arguments.length === 4 && typeof obj === 'function') {
|
|
2780
2691
|
var tmpMsg = delta;
|
|
@@ -2799,14 +2710,14 @@ assert.decreasesBy = function (fn, obj, prop, delta, msg) {
|
|
|
2799
2710
|
* assert.doesNotDecrease(fn, obj, 'val');
|
|
2800
2711
|
*
|
|
2801
2712
|
* @name doesNotDecrease
|
|
2802
|
-
* @param {Function} modifier function
|
|
2803
|
-
* @param {
|
|
2804
|
-
* @param {
|
|
2805
|
-
* @
|
|
2713
|
+
* @param {Function} fn modifier function
|
|
2714
|
+
* @param {object} obj object or getter function
|
|
2715
|
+
* @param {string} prop property name _optional_
|
|
2716
|
+
* @returns {Assertion}
|
|
2717
|
+
* @param {string} msg _optional_
|
|
2806
2718
|
* @namespace Assert
|
|
2807
|
-
* @
|
|
2719
|
+
* @public
|
|
2808
2720
|
*/
|
|
2809
|
-
|
|
2810
2721
|
assert.doesNotDecrease = function (fn, obj, prop, msg) {
|
|
2811
2722
|
if (arguments.length === 3 && typeof obj === 'function') {
|
|
2812
2723
|
msg = prop;
|
|
@@ -2827,15 +2738,15 @@ assert.doesNotDecrease = function (fn, obj, prop, msg) {
|
|
|
2827
2738
|
* assert.doesNotDecreaseBy(fn, obj, 'val', 1);
|
|
2828
2739
|
*
|
|
2829
2740
|
* @name doesNotDecreaseBy
|
|
2830
|
-
* @param {Function} modifier function
|
|
2831
|
-
* @param {
|
|
2832
|
-
* @param {
|
|
2833
|
-
* @param {
|
|
2834
|
-
* @
|
|
2741
|
+
* @param {Function} fn modifier function
|
|
2742
|
+
* @param {object} obj object or getter function
|
|
2743
|
+
* @param {string} prop property name _optional_
|
|
2744
|
+
* @param {number} delta change amount (delta)
|
|
2745
|
+
* @returns {Assertion}
|
|
2746
|
+
* @param {string} msg _optional_
|
|
2835
2747
|
* @namespace Assert
|
|
2836
|
-
* @
|
|
2748
|
+
* @public
|
|
2837
2749
|
*/
|
|
2838
|
-
|
|
2839
2750
|
assert.doesNotDecreaseBy = function (fn, obj, prop, delta, msg) {
|
|
2840
2751
|
if (arguments.length === 4 && typeof obj === 'function') {
|
|
2841
2752
|
var tmpMsg = delta;
|
|
@@ -2860,15 +2771,14 @@ assert.doesNotDecreaseBy = function (fn, obj, prop, delta, msg) {
|
|
|
2860
2771
|
* assert.decreasesButNotBy(fn, obj, 'val', 1);
|
|
2861
2772
|
*
|
|
2862
2773
|
* @name decreasesButNotBy
|
|
2863
|
-
* @param {Function} modifier function
|
|
2864
|
-
* @param {
|
|
2865
|
-
* @param {
|
|
2866
|
-
* @param {
|
|
2867
|
-
* @param {
|
|
2774
|
+
* @param {Function} fn modifier function
|
|
2775
|
+
* @param {object} obj object or getter function
|
|
2776
|
+
* @param {string} prop property name _optional_
|
|
2777
|
+
* @param {number} delta change amount (delta)
|
|
2778
|
+
* @param {string} msg _optional_
|
|
2868
2779
|
* @namespace Assert
|
|
2869
|
-
* @
|
|
2780
|
+
* @public
|
|
2870
2781
|
*/
|
|
2871
|
-
|
|
2872
2782
|
assert.decreasesButNotBy = function (fn, obj, prop, delta, msg) {
|
|
2873
2783
|
if (arguments.length === 4 && typeof obj === 'function') {
|
|
2874
2784
|
var tmpMsg = delta;
|
|
@@ -2883,7 +2793,7 @@ assert.decreasesButNotBy = function (fn, obj, prop, delta, msg) {
|
|
|
2883
2793
|
.to.decrease(obj, prop).but.not.by(delta);
|
|
2884
2794
|
}
|
|
2885
2795
|
|
|
2886
|
-
|
|
2796
|
+
/**
|
|
2887
2797
|
* ### .ifError(object)
|
|
2888
2798
|
*
|
|
2889
2799
|
* Asserts if value is not a false value, and throws if it is a true value.
|
|
@@ -2894,11 +2804,10 @@ assert.decreasesButNotBy = function (fn, obj, prop, delta, msg) {
|
|
|
2894
2804
|
* assert.ifError(err); // Rethrows err!
|
|
2895
2805
|
*
|
|
2896
2806
|
* @name ifError
|
|
2897
|
-
* @param {
|
|
2807
|
+
* @param {object} val
|
|
2898
2808
|
* @namespace Assert
|
|
2899
|
-
* @
|
|
2809
|
+
* @public
|
|
2900
2810
|
*/
|
|
2901
|
-
|
|
2902
2811
|
assert.ifError = function (val) {
|
|
2903
2812
|
if (val) {
|
|
2904
2813
|
throw(val);
|
|
@@ -2914,12 +2823,11 @@ assert.ifError = function (val) {
|
|
|
2914
2823
|
*
|
|
2915
2824
|
* @name isExtensible
|
|
2916
2825
|
* @alias extensible
|
|
2917
|
-
* @param {
|
|
2918
|
-
* @param {
|
|
2826
|
+
* @param {object} obj
|
|
2827
|
+
* @param {string} msg _optional_
|
|
2919
2828
|
* @namespace Assert
|
|
2920
|
-
* @
|
|
2829
|
+
* @public
|
|
2921
2830
|
*/
|
|
2922
|
-
|
|
2923
2831
|
assert.isExtensible = function (obj, msg) {
|
|
2924
2832
|
new Assertion(obj, msg, assert.isExtensible, true).to.be.extensible;
|
|
2925
2833
|
};
|
|
@@ -2939,12 +2847,11 @@ assert.isExtensible = function (obj, msg) {
|
|
|
2939
2847
|
*
|
|
2940
2848
|
* @name isNotExtensible
|
|
2941
2849
|
* @alias notExtensible
|
|
2942
|
-
* @param {
|
|
2943
|
-
* @param {
|
|
2850
|
+
* @param {object} obj
|
|
2851
|
+
* @param {string} msg _optional_
|
|
2944
2852
|
* @namespace Assert
|
|
2945
|
-
* @
|
|
2853
|
+
* @public
|
|
2946
2854
|
*/
|
|
2947
|
-
|
|
2948
2855
|
assert.isNotExtensible = function (obj, msg) {
|
|
2949
2856
|
new Assertion(obj, msg, assert.isNotExtensible, true).to.not.be.extensible;
|
|
2950
2857
|
};
|
|
@@ -2963,12 +2870,11 @@ assert.isNotExtensible = function (obj, msg) {
|
|
|
2963
2870
|
*
|
|
2964
2871
|
* @name isSealed
|
|
2965
2872
|
* @alias sealed
|
|
2966
|
-
* @param {
|
|
2967
|
-
* @param {
|
|
2873
|
+
* @param {object} obj
|
|
2874
|
+
* @param {string} msg _optional_
|
|
2968
2875
|
* @namespace Assert
|
|
2969
|
-
* @
|
|
2876
|
+
* @public
|
|
2970
2877
|
*/
|
|
2971
|
-
|
|
2972
2878
|
assert.isSealed = function (obj, msg) {
|
|
2973
2879
|
new Assertion(obj, msg, assert.isSealed, true).to.be.sealed;
|
|
2974
2880
|
};
|
|
@@ -2982,12 +2888,11 @@ assert.isSealed = function (obj, msg) {
|
|
|
2982
2888
|
*
|
|
2983
2889
|
* @name isNotSealed
|
|
2984
2890
|
* @alias notSealed
|
|
2985
|
-
* @param {
|
|
2986
|
-
* @param {
|
|
2891
|
+
* @param {object} obj
|
|
2892
|
+
* @param {string} msg _optional_
|
|
2987
2893
|
* @namespace Assert
|
|
2988
|
-
* @
|
|
2894
|
+
* @public
|
|
2989
2895
|
*/
|
|
2990
|
-
|
|
2991
2896
|
assert.isNotSealed = function (obj, msg) {
|
|
2992
2897
|
new Assertion(obj, msg, assert.isNotSealed, true).to.not.be.sealed;
|
|
2993
2898
|
};
|
|
@@ -3003,12 +2908,11 @@ assert.isNotSealed = function (obj, msg) {
|
|
|
3003
2908
|
*
|
|
3004
2909
|
* @name isFrozen
|
|
3005
2910
|
* @alias frozen
|
|
3006
|
-
* @param {
|
|
3007
|
-
* @param {
|
|
2911
|
+
* @param {object} obj
|
|
2912
|
+
* @param {string} msg _optional_
|
|
3008
2913
|
* @namespace Assert
|
|
3009
|
-
* @
|
|
2914
|
+
* @public
|
|
3010
2915
|
*/
|
|
3011
|
-
|
|
3012
2916
|
assert.isFrozen = function (obj, msg) {
|
|
3013
2917
|
new Assertion(obj, msg, assert.isFrozen, true).to.be.frozen;
|
|
3014
2918
|
};
|
|
@@ -3022,12 +2926,11 @@ assert.isFrozen = function (obj, msg) {
|
|
|
3022
2926
|
*
|
|
3023
2927
|
* @name isNotFrozen
|
|
3024
2928
|
* @alias notFrozen
|
|
3025
|
-
* @param {
|
|
3026
|
-
* @param {
|
|
2929
|
+
* @param {object} obj
|
|
2930
|
+
* @param {string} msg _optional_
|
|
3027
2931
|
* @namespace Assert
|
|
3028
|
-
* @
|
|
2932
|
+
* @public
|
|
3029
2933
|
*/
|
|
3030
|
-
|
|
3031
2934
|
assert.isNotFrozen = function (obj, msg) {
|
|
3032
2935
|
new Assertion(obj, msg, assert.isNotFrozen, true).to.not.be.frozen;
|
|
3033
2936
|
};
|
|
@@ -3048,12 +2951,11 @@ assert.isNotFrozen = function (obj, msg) {
|
|
|
3048
2951
|
*
|
|
3049
2952
|
* @name isEmpty
|
|
3050
2953
|
* @alias empty
|
|
3051
|
-
* @param {
|
|
3052
|
-
* @param {
|
|
2954
|
+
* @param {object | Array | string | Map | Set} val
|
|
2955
|
+
* @param {string} msg _optional_
|
|
3053
2956
|
* @namespace Assert
|
|
3054
|
-
* @
|
|
2957
|
+
* @public
|
|
3055
2958
|
*/
|
|
3056
|
-
|
|
3057
2959
|
assert.isEmpty = function(val, msg) {
|
|
3058
2960
|
new Assertion(val, msg, assert.isEmpty, true).to.be.empty;
|
|
3059
2961
|
};
|
|
@@ -3074,20 +2976,22 @@ assert.isEmpty = function(val, msg) {
|
|
|
3074
2976
|
*
|
|
3075
2977
|
* @name isNotEmpty
|
|
3076
2978
|
* @alias notEmpty
|
|
3077
|
-
* @param {
|
|
3078
|
-
* @param {
|
|
2979
|
+
* @param {object | Array | string | Map | Set} val
|
|
2980
|
+
* @param {string} msg _optional_
|
|
3079
2981
|
* @namespace Assert
|
|
3080
|
-
* @
|
|
2982
|
+
* @public
|
|
3081
2983
|
*/
|
|
3082
|
-
|
|
3083
2984
|
assert.isNotEmpty = function(val, msg) {
|
|
3084
2985
|
new Assertion(val, msg, assert.isNotEmpty, true).to.not.be.empty;
|
|
3085
2986
|
};
|
|
3086
2987
|
|
|
3087
|
-
|
|
2988
|
+
/**
|
|
3088
2989
|
* Aliases.
|
|
2990
|
+
*
|
|
2991
|
+
* @param {unknown} name
|
|
2992
|
+
* @param {unknown} as
|
|
2993
|
+
* @returns {unknown}
|
|
3089
2994
|
*/
|
|
3090
|
-
|
|
3091
2995
|
(function alias(name, as){
|
|
3092
2996
|
assert[as] = assert[name];
|
|
3093
2997
|
return alias;
|