ende 0.5.6 → 0.5.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/component.json +2 -2
- data/components/component/bind/{0.0.1 → 1.0.0}/component.json +1 -1
- data/components/component/bind/{0.0.1 → 1.0.0}/index.js +1 -2
- data/components/component/jquery/1.0.0/component.json +10 -0
- data/components/component/jquery/1.0.0/index.js +10308 -0
- data/components/component/matches-selector/{0.1.2 → 0.1.4}/component.json +1 -1
- data/components/component/matches-selector/{0.1.2 → 0.1.4}/index.js +0 -0
- data/components/indefinido/advisable/master/component.json +1 -1
- data/components/indefinido/indemma/master/component.json +4 -7
- data/components/indefinido/indemma/master/lib/record.js +7 -2
- data/components/indefinido/indemma/master/lib/record/dirtyable.js +15 -6
- data/components/indefinido/indemma/master/lib/record/scopable.js +1 -1
- data/components/indefinido/observable/es6-modules/component.json +1 -1
- data/components/indefinido/observable/es6-modules/lib/legacy/schedulerable.js +8 -3
- data/components/indefinido/observable/es6-modules/lib/observable.js +0 -1
- data/components/indefinido/observable/es6-modules/lib/observable/observation.js +2 -2
- data/components/paulmillr/es6-shim/{0.10.1 → 0.14.0}/component.json +1 -1
- data/components/paulmillr/es6-shim/{0.10.1 → 0.14.0}/es6-shim.js +151 -102
- data/components/pluma/assimilate/{0.3.0 → 0.4.0}/component.json +2 -2
- data/components/pluma/assimilate/{0.3.0 → 0.4.0}/dist/assimilate.js +1 -1
- data/lib/assets/javascripts/aura/extensions/rivets.js.coffee +12 -6
- data/lib/assets/javascripts/config/load_components.js.coffee +1 -1
- data/lib/assets/javascripts/ende.js.coffee +1 -1
- data/lib/ende/version.rb +1 -1
- data/vendor/assets/component/build.css +112 -0
- data/vendor/assets/components/ende_build.js +20357 -19584
- metadata +13 -84
- data/components/chaijs/assertion-error/1.0.0/component.json +0 -18
- data/components/chaijs/assertion-error/1.0.0/index.js +0 -110
- data/components/chaijs/chai/1.9.1/.gitignore +0 -22
- data/components/chaijs/chai/1.9.1/.mailmap +0 -1
- data/components/chaijs/chai/1.9.1/.npmignore +0 -14
- data/components/chaijs/chai/1.9.1/.travis.yml +0 -14
- data/components/chaijs/chai/1.9.1/CONTRIBUTING.md +0 -173
- data/components/chaijs/chai/1.9.1/History.md +0 -895
- data/components/chaijs/chai/1.9.1/Makefile +0 -93
- data/components/chaijs/chai/1.9.1/README.md +0 -99
- data/components/chaijs/chai/1.9.1/ReleaseNotes.md +0 -482
- data/components/chaijs/chai/1.9.1/bower.json +0 -27
- data/components/chaijs/chai/1.9.1/chai.js +0 -4782
- data/components/chaijs/chai/1.9.1/component.json +0 -50
- data/components/chaijs/chai/1.9.1/index.js +0 -1
- data/components/chaijs/chai/1.9.1/karma.conf.js +0 -28
- data/components/chaijs/chai/1.9.1/karma.sauce.js +0 -41
- data/components/chaijs/chai/1.9.1/lib/chai.js +0 -87
- data/components/chaijs/chai/1.9.1/lib/chai/assertion.js +0 -130
- data/components/chaijs/chai/1.9.1/lib/chai/config.js +0 -50
- data/components/chaijs/chai/1.9.1/lib/chai/core/assertions.js +0 -1314
- data/components/chaijs/chai/1.9.1/lib/chai/interface/assert.js +0 -1056
- data/components/chaijs/chai/1.9.1/lib/chai/interface/expect.js +0 -12
- data/components/chaijs/chai/1.9.1/lib/chai/interface/should.js +0 -78
- data/components/chaijs/chai/1.9.1/lib/chai/utils/addChainableMethod.js +0 -111
- data/components/chaijs/chai/1.9.1/lib/chai/utils/addMethod.js +0 -43
- data/components/chaijs/chai/1.9.1/lib/chai/utils/addProperty.js +0 -40
- data/components/chaijs/chai/1.9.1/lib/chai/utils/flag.js +0 -32
- data/components/chaijs/chai/1.9.1/lib/chai/utils/getActual.js +0 -18
- data/components/chaijs/chai/1.9.1/lib/chai/utils/getEnumerableProperties.js +0 -25
- data/components/chaijs/chai/1.9.1/lib/chai/utils/getMessage.js +0 -49
- data/components/chaijs/chai/1.9.1/lib/chai/utils/getName.js +0 -20
- data/components/chaijs/chai/1.9.1/lib/chai/utils/getPathValue.js +0 -102
- data/components/chaijs/chai/1.9.1/lib/chai/utils/getProperties.js +0 -35
- data/components/chaijs/chai/1.9.1/lib/chai/utils/index.js +0 -114
- data/components/chaijs/chai/1.9.1/lib/chai/utils/inspect.js +0 -320
- data/components/chaijs/chai/1.9.1/lib/chai/utils/objDisplay.js +0 -49
- data/components/chaijs/chai/1.9.1/lib/chai/utils/overwriteChainableMethod.js +0 -53
- data/components/chaijs/chai/1.9.1/lib/chai/utils/overwriteMethod.js +0 -51
- data/components/chaijs/chai/1.9.1/lib/chai/utils/overwriteProperty.js +0 -54
- data/components/chaijs/chai/1.9.1/lib/chai/utils/test.js +0 -26
- data/components/chaijs/chai/1.9.1/lib/chai/utils/transferFlags.js +0 -44
- data/components/chaijs/chai/1.9.1/lib/chai/utils/type.js +0 -45
- data/components/chaijs/chai/1.9.1/package.json +0 -42
- data/components/chaijs/chai/1.9.1/sauce.browsers.js +0 -128
- data/components/chaijs/chai/1.9.1/support/sauce/sauce_connect_block.sh +0 -7
- data/components/chaijs/chai/1.9.1/support/sauce/sauce_connect_setup.sh +0 -53
- data/components/chaijs/chai/1.9.1/test/assert.js +0 -638
- data/components/chaijs/chai/1.9.1/test/auth/.gitkeep +0 -0
- data/components/chaijs/chai/1.9.1/test/bootstrap/index.js +0 -22
- data/components/chaijs/chai/1.9.1/test/bootstrap/karma.js +0 -22
- data/components/chaijs/chai/1.9.1/test/configuration.js +0 -133
- data/components/chaijs/chai/1.9.1/test/display/errors.js +0 -14
- data/components/chaijs/chai/1.9.1/test/display/message.js +0 -47
- data/components/chaijs/chai/1.9.1/test/expect.js +0 -814
- data/components/chaijs/chai/1.9.1/test/globalShould.js +0 -15
- data/components/chaijs/chai/1.9.1/test/plugins.js +0 -24
- data/components/chaijs/chai/1.9.1/test/should.js +0 -744
- data/components/chaijs/chai/1.9.1/test/utilities.js +0 -309
- data/components/chaijs/deep-eql/0.1.3/component.json +0 -20
- data/components/chaijs/deep-eql/0.1.3/lib/eql.js +0 -257
- data/components/chaijs/type-detect/0.1.1/component.json +0 -18
- data/components/chaijs/type-detect/0.1.1/lib/type.js +0 -142
- data/components/component/classes/1.2.1/component.json +0 -19
- data/components/component/classes/1.2.1/index.js +0 -184
- data/components/component/domify/1.2.2/component.json +0 -22
- data/components/component/domify/1.2.2/index.js +0 -87
- data/components/component/event/0.1.3/component.json +0 -13
- data/components/component/event/0.1.3/index.js +0 -35
- data/components/component/jquery/1.9.1/component.json +0 -14
- data/components/component/jquery/1.9.1/index.js +0 -9601
- data/components/component/query/0.0.3/component.json +0 -23
- data/components/component/query/0.0.3/index.js +0 -21
- data/lib/tasks/.gitkeep +0 -0
@@ -1,1056 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* chai
|
3
|
-
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
4
|
-
* MIT Licensed
|
5
|
-
*/
|
6
|
-
|
7
|
-
|
8
|
-
module.exports = function (chai, util) {
|
9
|
-
|
10
|
-
/*!
|
11
|
-
* Chai dependencies.
|
12
|
-
*/
|
13
|
-
|
14
|
-
var Assertion = chai.Assertion
|
15
|
-
, flag = util.flag;
|
16
|
-
|
17
|
-
/*!
|
18
|
-
* Module export.
|
19
|
-
*/
|
20
|
-
|
21
|
-
/**
|
22
|
-
* ### assert(expression, message)
|
23
|
-
*
|
24
|
-
* Write your own test expressions.
|
25
|
-
*
|
26
|
-
* assert('foo' !== 'bar', 'foo is not bar');
|
27
|
-
* assert(Array.isArray([]), 'empty arrays are arrays');
|
28
|
-
*
|
29
|
-
* @param {Mixed} expression to test for truthiness
|
30
|
-
* @param {String} message to display on error
|
31
|
-
* @name assert
|
32
|
-
* @api public
|
33
|
-
*/
|
34
|
-
|
35
|
-
var assert = chai.assert = function (express, errmsg) {
|
36
|
-
var test = new Assertion(null, null, chai.assert);
|
37
|
-
test.assert(
|
38
|
-
express
|
39
|
-
, errmsg
|
40
|
-
, '[ negation message unavailable ]'
|
41
|
-
);
|
42
|
-
};
|
43
|
-
|
44
|
-
/**
|
45
|
-
* ### .fail(actual, expected, [message], [operator])
|
46
|
-
*
|
47
|
-
* Throw a failure. Node.js `assert` module-compatible.
|
48
|
-
*
|
49
|
-
* @name fail
|
50
|
-
* @param {Mixed} actual
|
51
|
-
* @param {Mixed} expected
|
52
|
-
* @param {String} message
|
53
|
-
* @param {String} operator
|
54
|
-
* @api public
|
55
|
-
*/
|
56
|
-
|
57
|
-
assert.fail = function (actual, expected, message, operator) {
|
58
|
-
message = message || 'assert.fail()';
|
59
|
-
throw new chai.AssertionError(message, {
|
60
|
-
actual: actual
|
61
|
-
, expected: expected
|
62
|
-
, operator: operator
|
63
|
-
}, assert.fail);
|
64
|
-
};
|
65
|
-
|
66
|
-
/**
|
67
|
-
* ### .ok(object, [message])
|
68
|
-
*
|
69
|
-
* Asserts that `object` is truthy.
|
70
|
-
*
|
71
|
-
* assert.ok('everything', 'everything is ok');
|
72
|
-
* assert.ok(false, 'this will fail');
|
73
|
-
*
|
74
|
-
* @name ok
|
75
|
-
* @param {Mixed} object to test
|
76
|
-
* @param {String} message
|
77
|
-
* @api public
|
78
|
-
*/
|
79
|
-
|
80
|
-
assert.ok = function (val, msg) {
|
81
|
-
new Assertion(val, msg).is.ok;
|
82
|
-
};
|
83
|
-
|
84
|
-
/**
|
85
|
-
* ### .notOk(object, [message])
|
86
|
-
*
|
87
|
-
* Asserts that `object` is falsy.
|
88
|
-
*
|
89
|
-
* assert.notOk('everything', 'this will fail');
|
90
|
-
* assert.notOk(false, 'this will pass');
|
91
|
-
*
|
92
|
-
* @name notOk
|
93
|
-
* @param {Mixed} object to test
|
94
|
-
* @param {String} message
|
95
|
-
* @api public
|
96
|
-
*/
|
97
|
-
|
98
|
-
assert.notOk = function (val, msg) {
|
99
|
-
new Assertion(val, msg).is.not.ok;
|
100
|
-
};
|
101
|
-
|
102
|
-
/**
|
103
|
-
* ### .equal(actual, expected, [message])
|
104
|
-
*
|
105
|
-
* Asserts non-strict equality (`==`) of `actual` and `expected`.
|
106
|
-
*
|
107
|
-
* assert.equal(3, '3', '== coerces values to strings');
|
108
|
-
*
|
109
|
-
* @name equal
|
110
|
-
* @param {Mixed} actual
|
111
|
-
* @param {Mixed} expected
|
112
|
-
* @param {String} message
|
113
|
-
* @api public
|
114
|
-
*/
|
115
|
-
|
116
|
-
assert.equal = function (act, exp, msg) {
|
117
|
-
var test = new Assertion(act, msg, assert.equal);
|
118
|
-
|
119
|
-
test.assert(
|
120
|
-
exp == flag(test, 'object')
|
121
|
-
, 'expected #{this} to equal #{exp}'
|
122
|
-
, 'expected #{this} to not equal #{act}'
|
123
|
-
, exp
|
124
|
-
, act
|
125
|
-
);
|
126
|
-
};
|
127
|
-
|
128
|
-
/**
|
129
|
-
* ### .notEqual(actual, expected, [message])
|
130
|
-
*
|
131
|
-
* Asserts non-strict inequality (`!=`) of `actual` and `expected`.
|
132
|
-
*
|
133
|
-
* assert.notEqual(3, 4, 'these numbers are not equal');
|
134
|
-
*
|
135
|
-
* @name notEqual
|
136
|
-
* @param {Mixed} actual
|
137
|
-
* @param {Mixed} expected
|
138
|
-
* @param {String} message
|
139
|
-
* @api public
|
140
|
-
*/
|
141
|
-
|
142
|
-
assert.notEqual = function (act, exp, msg) {
|
143
|
-
var test = new Assertion(act, msg, assert.notEqual);
|
144
|
-
|
145
|
-
test.assert(
|
146
|
-
exp != flag(test, 'object')
|
147
|
-
, 'expected #{this} to not equal #{exp}'
|
148
|
-
, 'expected #{this} to equal #{act}'
|
149
|
-
, exp
|
150
|
-
, act
|
151
|
-
);
|
152
|
-
};
|
153
|
-
|
154
|
-
/**
|
155
|
-
* ### .strictEqual(actual, expected, [message])
|
156
|
-
*
|
157
|
-
* Asserts strict equality (`===`) of `actual` and `expected`.
|
158
|
-
*
|
159
|
-
* assert.strictEqual(true, true, 'these booleans are strictly equal');
|
160
|
-
*
|
161
|
-
* @name strictEqual
|
162
|
-
* @param {Mixed} actual
|
163
|
-
* @param {Mixed} expected
|
164
|
-
* @param {String} message
|
165
|
-
* @api public
|
166
|
-
*/
|
167
|
-
|
168
|
-
assert.strictEqual = function (act, exp, msg) {
|
169
|
-
new Assertion(act, msg).to.equal(exp);
|
170
|
-
};
|
171
|
-
|
172
|
-
/**
|
173
|
-
* ### .notStrictEqual(actual, expected, [message])
|
174
|
-
*
|
175
|
-
* Asserts strict inequality (`!==`) of `actual` and `expected`.
|
176
|
-
*
|
177
|
-
* assert.notStrictEqual(3, '3', 'no coercion for strict equality');
|
178
|
-
*
|
179
|
-
* @name notStrictEqual
|
180
|
-
* @param {Mixed} actual
|
181
|
-
* @param {Mixed} expected
|
182
|
-
* @param {String} message
|
183
|
-
* @api public
|
184
|
-
*/
|
185
|
-
|
186
|
-
assert.notStrictEqual = function (act, exp, msg) {
|
187
|
-
new Assertion(act, msg).to.not.equal(exp);
|
188
|
-
};
|
189
|
-
|
190
|
-
/**
|
191
|
-
* ### .deepEqual(actual, expected, [message])
|
192
|
-
*
|
193
|
-
* Asserts that `actual` is deeply equal to `expected`.
|
194
|
-
*
|
195
|
-
* assert.deepEqual({ tea: 'green' }, { tea: 'green' });
|
196
|
-
*
|
197
|
-
* @name deepEqual
|
198
|
-
* @param {Mixed} actual
|
199
|
-
* @param {Mixed} expected
|
200
|
-
* @param {String} message
|
201
|
-
* @api public
|
202
|
-
*/
|
203
|
-
|
204
|
-
assert.deepEqual = function (act, exp, msg) {
|
205
|
-
new Assertion(act, msg).to.eql(exp);
|
206
|
-
};
|
207
|
-
|
208
|
-
/**
|
209
|
-
* ### .notDeepEqual(actual, expected, [message])
|
210
|
-
*
|
211
|
-
* Assert that `actual` is not deeply equal to `expected`.
|
212
|
-
*
|
213
|
-
* assert.notDeepEqual({ tea: 'green' }, { tea: 'jasmine' });
|
214
|
-
*
|
215
|
-
* @name notDeepEqual
|
216
|
-
* @param {Mixed} actual
|
217
|
-
* @param {Mixed} expected
|
218
|
-
* @param {String} message
|
219
|
-
* @api public
|
220
|
-
*/
|
221
|
-
|
222
|
-
assert.notDeepEqual = function (act, exp, msg) {
|
223
|
-
new Assertion(act, msg).to.not.eql(exp);
|
224
|
-
};
|
225
|
-
|
226
|
-
/**
|
227
|
-
* ### .isTrue(value, [message])
|
228
|
-
*
|
229
|
-
* Asserts that `value` is true.
|
230
|
-
*
|
231
|
-
* var teaServed = true;
|
232
|
-
* assert.isTrue(teaServed, 'the tea has been served');
|
233
|
-
*
|
234
|
-
* @name isTrue
|
235
|
-
* @param {Mixed} value
|
236
|
-
* @param {String} message
|
237
|
-
* @api public
|
238
|
-
*/
|
239
|
-
|
240
|
-
assert.isTrue = function (val, msg) {
|
241
|
-
new Assertion(val, msg).is['true'];
|
242
|
-
};
|
243
|
-
|
244
|
-
/**
|
245
|
-
* ### .isFalse(value, [message])
|
246
|
-
*
|
247
|
-
* Asserts that `value` is false.
|
248
|
-
*
|
249
|
-
* var teaServed = false;
|
250
|
-
* assert.isFalse(teaServed, 'no tea yet? hmm...');
|
251
|
-
*
|
252
|
-
* @name isFalse
|
253
|
-
* @param {Mixed} value
|
254
|
-
* @param {String} message
|
255
|
-
* @api public
|
256
|
-
*/
|
257
|
-
|
258
|
-
assert.isFalse = function (val, msg) {
|
259
|
-
new Assertion(val, msg).is['false'];
|
260
|
-
};
|
261
|
-
|
262
|
-
/**
|
263
|
-
* ### .isNull(value, [message])
|
264
|
-
*
|
265
|
-
* Asserts that `value` is null.
|
266
|
-
*
|
267
|
-
* assert.isNull(err, 'there was no error');
|
268
|
-
*
|
269
|
-
* @name isNull
|
270
|
-
* @param {Mixed} value
|
271
|
-
* @param {String} message
|
272
|
-
* @api public
|
273
|
-
*/
|
274
|
-
|
275
|
-
assert.isNull = function (val, msg) {
|
276
|
-
new Assertion(val, msg).to.equal(null);
|
277
|
-
};
|
278
|
-
|
279
|
-
/**
|
280
|
-
* ### .isNotNull(value, [message])
|
281
|
-
*
|
282
|
-
* Asserts that `value` is not null.
|
283
|
-
*
|
284
|
-
* var tea = 'tasty chai';
|
285
|
-
* assert.isNotNull(tea, 'great, time for tea!');
|
286
|
-
*
|
287
|
-
* @name isNotNull
|
288
|
-
* @param {Mixed} value
|
289
|
-
* @param {String} message
|
290
|
-
* @api public
|
291
|
-
*/
|
292
|
-
|
293
|
-
assert.isNotNull = function (val, msg) {
|
294
|
-
new Assertion(val, msg).to.not.equal(null);
|
295
|
-
};
|
296
|
-
|
297
|
-
/**
|
298
|
-
* ### .isUndefined(value, [message])
|
299
|
-
*
|
300
|
-
* Asserts that `value` is `undefined`.
|
301
|
-
*
|
302
|
-
* var tea;
|
303
|
-
* assert.isUndefined(tea, 'no tea defined');
|
304
|
-
*
|
305
|
-
* @name isUndefined
|
306
|
-
* @param {Mixed} value
|
307
|
-
* @param {String} message
|
308
|
-
* @api public
|
309
|
-
*/
|
310
|
-
|
311
|
-
assert.isUndefined = function (val, msg) {
|
312
|
-
new Assertion(val, msg).to.equal(undefined);
|
313
|
-
};
|
314
|
-
|
315
|
-
/**
|
316
|
-
* ### .isDefined(value, [message])
|
317
|
-
*
|
318
|
-
* Asserts that `value` is not `undefined`.
|
319
|
-
*
|
320
|
-
* var tea = 'cup of chai';
|
321
|
-
* assert.isDefined(tea, 'tea has been defined');
|
322
|
-
*
|
323
|
-
* @name isDefined
|
324
|
-
* @param {Mixed} value
|
325
|
-
* @param {String} message
|
326
|
-
* @api public
|
327
|
-
*/
|
328
|
-
|
329
|
-
assert.isDefined = function (val, msg) {
|
330
|
-
new Assertion(val, msg).to.not.equal(undefined);
|
331
|
-
};
|
332
|
-
|
333
|
-
/**
|
334
|
-
* ### .isFunction(value, [message])
|
335
|
-
*
|
336
|
-
* Asserts that `value` is a function.
|
337
|
-
*
|
338
|
-
* function serveTea() { return 'cup of tea'; };
|
339
|
-
* assert.isFunction(serveTea, 'great, we can have tea now');
|
340
|
-
*
|
341
|
-
* @name isFunction
|
342
|
-
* @param {Mixed} value
|
343
|
-
* @param {String} message
|
344
|
-
* @api public
|
345
|
-
*/
|
346
|
-
|
347
|
-
assert.isFunction = function (val, msg) {
|
348
|
-
new Assertion(val, msg).to.be.a('function');
|
349
|
-
};
|
350
|
-
|
351
|
-
/**
|
352
|
-
* ### .isNotFunction(value, [message])
|
353
|
-
*
|
354
|
-
* Asserts that `value` is _not_ a function.
|
355
|
-
*
|
356
|
-
* var serveTea = [ 'heat', 'pour', 'sip' ];
|
357
|
-
* assert.isNotFunction(serveTea, 'great, we have listed the steps');
|
358
|
-
*
|
359
|
-
* @name isNotFunction
|
360
|
-
* @param {Mixed} value
|
361
|
-
* @param {String} message
|
362
|
-
* @api public
|
363
|
-
*/
|
364
|
-
|
365
|
-
assert.isNotFunction = function (val, msg) {
|
366
|
-
new Assertion(val, msg).to.not.be.a('function');
|
367
|
-
};
|
368
|
-
|
369
|
-
/**
|
370
|
-
* ### .isObject(value, [message])
|
371
|
-
*
|
372
|
-
* Asserts that `value` is an object (as revealed by
|
373
|
-
* `Object.prototype.toString`).
|
374
|
-
*
|
375
|
-
* var selection = { name: 'Chai', serve: 'with spices' };
|
376
|
-
* assert.isObject(selection, 'tea selection is an object');
|
377
|
-
*
|
378
|
-
* @name isObject
|
379
|
-
* @param {Mixed} value
|
380
|
-
* @param {String} message
|
381
|
-
* @api public
|
382
|
-
*/
|
383
|
-
|
384
|
-
assert.isObject = function (val, msg) {
|
385
|
-
new Assertion(val, msg).to.be.a('object');
|
386
|
-
};
|
387
|
-
|
388
|
-
/**
|
389
|
-
* ### .isNotObject(value, [message])
|
390
|
-
*
|
391
|
-
* Asserts that `value` is _not_ an object.
|
392
|
-
*
|
393
|
-
* var selection = 'chai'
|
394
|
-
* assert.isNotObject(selection, 'tea selection is not an object');
|
395
|
-
* assert.isNotObject(null, 'null is not an object');
|
396
|
-
*
|
397
|
-
* @name isNotObject
|
398
|
-
* @param {Mixed} value
|
399
|
-
* @param {String} message
|
400
|
-
* @api public
|
401
|
-
*/
|
402
|
-
|
403
|
-
assert.isNotObject = function (val, msg) {
|
404
|
-
new Assertion(val, msg).to.not.be.a('object');
|
405
|
-
};
|
406
|
-
|
407
|
-
/**
|
408
|
-
* ### .isArray(value, [message])
|
409
|
-
*
|
410
|
-
* Asserts that `value` is an array.
|
411
|
-
*
|
412
|
-
* var menu = [ 'green', 'chai', 'oolong' ];
|
413
|
-
* assert.isArray(menu, 'what kind of tea do we want?');
|
414
|
-
*
|
415
|
-
* @name isArray
|
416
|
-
* @param {Mixed} value
|
417
|
-
* @param {String} message
|
418
|
-
* @api public
|
419
|
-
*/
|
420
|
-
|
421
|
-
assert.isArray = function (val, msg) {
|
422
|
-
new Assertion(val, msg).to.be.an('array');
|
423
|
-
};
|
424
|
-
|
425
|
-
/**
|
426
|
-
* ### .isNotArray(value, [message])
|
427
|
-
*
|
428
|
-
* Asserts that `value` is _not_ an array.
|
429
|
-
*
|
430
|
-
* var menu = 'green|chai|oolong';
|
431
|
-
* assert.isNotArray(menu, 'what kind of tea do we want?');
|
432
|
-
*
|
433
|
-
* @name isNotArray
|
434
|
-
* @param {Mixed} value
|
435
|
-
* @param {String} message
|
436
|
-
* @api public
|
437
|
-
*/
|
438
|
-
|
439
|
-
assert.isNotArray = function (val, msg) {
|
440
|
-
new Assertion(val, msg).to.not.be.an('array');
|
441
|
-
};
|
442
|
-
|
443
|
-
/**
|
444
|
-
* ### .isString(value, [message])
|
445
|
-
*
|
446
|
-
* Asserts that `value` is a string.
|
447
|
-
*
|
448
|
-
* var teaOrder = 'chai';
|
449
|
-
* assert.isString(teaOrder, 'order placed');
|
450
|
-
*
|
451
|
-
* @name isString
|
452
|
-
* @param {Mixed} value
|
453
|
-
* @param {String} message
|
454
|
-
* @api public
|
455
|
-
*/
|
456
|
-
|
457
|
-
assert.isString = function (val, msg) {
|
458
|
-
new Assertion(val, msg).to.be.a('string');
|
459
|
-
};
|
460
|
-
|
461
|
-
/**
|
462
|
-
* ### .isNotString(value, [message])
|
463
|
-
*
|
464
|
-
* Asserts that `value` is _not_ a string.
|
465
|
-
*
|
466
|
-
* var teaOrder = 4;
|
467
|
-
* assert.isNotString(teaOrder, 'order placed');
|
468
|
-
*
|
469
|
-
* @name isNotString
|
470
|
-
* @param {Mixed} value
|
471
|
-
* @param {String} message
|
472
|
-
* @api public
|
473
|
-
*/
|
474
|
-
|
475
|
-
assert.isNotString = function (val, msg) {
|
476
|
-
new Assertion(val, msg).to.not.be.a('string');
|
477
|
-
};
|
478
|
-
|
479
|
-
/**
|
480
|
-
* ### .isNumber(value, [message])
|
481
|
-
*
|
482
|
-
* Asserts that `value` is a number.
|
483
|
-
*
|
484
|
-
* var cups = 2;
|
485
|
-
* assert.isNumber(cups, 'how many cups');
|
486
|
-
*
|
487
|
-
* @name isNumber
|
488
|
-
* @param {Number} value
|
489
|
-
* @param {String} message
|
490
|
-
* @api public
|
491
|
-
*/
|
492
|
-
|
493
|
-
assert.isNumber = function (val, msg) {
|
494
|
-
new Assertion(val, msg).to.be.a('number');
|
495
|
-
};
|
496
|
-
|
497
|
-
/**
|
498
|
-
* ### .isNotNumber(value, [message])
|
499
|
-
*
|
500
|
-
* Asserts that `value` is _not_ a number.
|
501
|
-
*
|
502
|
-
* var cups = '2 cups please';
|
503
|
-
* assert.isNotNumber(cups, 'how many cups');
|
504
|
-
*
|
505
|
-
* @name isNotNumber
|
506
|
-
* @param {Mixed} value
|
507
|
-
* @param {String} message
|
508
|
-
* @api public
|
509
|
-
*/
|
510
|
-
|
511
|
-
assert.isNotNumber = function (val, msg) {
|
512
|
-
new Assertion(val, msg).to.not.be.a('number');
|
513
|
-
};
|
514
|
-
|
515
|
-
/**
|
516
|
-
* ### .isBoolean(value, [message])
|
517
|
-
*
|
518
|
-
* Asserts that `value` is a boolean.
|
519
|
-
*
|
520
|
-
* var teaReady = true
|
521
|
-
* , teaServed = false;
|
522
|
-
*
|
523
|
-
* assert.isBoolean(teaReady, 'is the tea ready');
|
524
|
-
* assert.isBoolean(teaServed, 'has tea been served');
|
525
|
-
*
|
526
|
-
* @name isBoolean
|
527
|
-
* @param {Mixed} value
|
528
|
-
* @param {String} message
|
529
|
-
* @api public
|
530
|
-
*/
|
531
|
-
|
532
|
-
assert.isBoolean = function (val, msg) {
|
533
|
-
new Assertion(val, msg).to.be.a('boolean');
|
534
|
-
};
|
535
|
-
|
536
|
-
/**
|
537
|
-
* ### .isNotBoolean(value, [message])
|
538
|
-
*
|
539
|
-
* Asserts that `value` is _not_ a boolean.
|
540
|
-
*
|
541
|
-
* var teaReady = 'yep'
|
542
|
-
* , teaServed = 'nope';
|
543
|
-
*
|
544
|
-
* assert.isNotBoolean(teaReady, 'is the tea ready');
|
545
|
-
* assert.isNotBoolean(teaServed, 'has tea been served');
|
546
|
-
*
|
547
|
-
* @name isNotBoolean
|
548
|
-
* @param {Mixed} value
|
549
|
-
* @param {String} message
|
550
|
-
* @api public
|
551
|
-
*/
|
552
|
-
|
553
|
-
assert.isNotBoolean = function (val, msg) {
|
554
|
-
new Assertion(val, msg).to.not.be.a('boolean');
|
555
|
-
};
|
556
|
-
|
557
|
-
/**
|
558
|
-
* ### .typeOf(value, name, [message])
|
559
|
-
*
|
560
|
-
* Asserts that `value`'s type is `name`, as determined by
|
561
|
-
* `Object.prototype.toString`.
|
562
|
-
*
|
563
|
-
* assert.typeOf({ tea: 'chai' }, 'object', 'we have an object');
|
564
|
-
* assert.typeOf(['chai', 'jasmine'], 'array', 'we have an array');
|
565
|
-
* assert.typeOf('tea', 'string', 'we have a string');
|
566
|
-
* assert.typeOf(/tea/, 'regexp', 'we have a regular expression');
|
567
|
-
* assert.typeOf(null, 'null', 'we have a null');
|
568
|
-
* assert.typeOf(undefined, 'undefined', 'we have an undefined');
|
569
|
-
*
|
570
|
-
* @name typeOf
|
571
|
-
* @param {Mixed} value
|
572
|
-
* @param {String} name
|
573
|
-
* @param {String} message
|
574
|
-
* @api public
|
575
|
-
*/
|
576
|
-
|
577
|
-
assert.typeOf = function (val, type, msg) {
|
578
|
-
new Assertion(val, msg).to.be.a(type);
|
579
|
-
};
|
580
|
-
|
581
|
-
/**
|
582
|
-
* ### .notTypeOf(value, name, [message])
|
583
|
-
*
|
584
|
-
* Asserts that `value`'s type is _not_ `name`, as determined by
|
585
|
-
* `Object.prototype.toString`.
|
586
|
-
*
|
587
|
-
* assert.notTypeOf('tea', 'number', 'strings are not numbers');
|
588
|
-
*
|
589
|
-
* @name notTypeOf
|
590
|
-
* @param {Mixed} value
|
591
|
-
* @param {String} typeof name
|
592
|
-
* @param {String} message
|
593
|
-
* @api public
|
594
|
-
*/
|
595
|
-
|
596
|
-
assert.notTypeOf = function (val, type, msg) {
|
597
|
-
new Assertion(val, msg).to.not.be.a(type);
|
598
|
-
};
|
599
|
-
|
600
|
-
/**
|
601
|
-
* ### .instanceOf(object, constructor, [message])
|
602
|
-
*
|
603
|
-
* Asserts that `value` is an instance of `constructor`.
|
604
|
-
*
|
605
|
-
* var Tea = function (name) { this.name = name; }
|
606
|
-
* , chai = new Tea('chai');
|
607
|
-
*
|
608
|
-
* assert.instanceOf(chai, Tea, 'chai is an instance of tea');
|
609
|
-
*
|
610
|
-
* @name instanceOf
|
611
|
-
* @param {Object} object
|
612
|
-
* @param {Constructor} constructor
|
613
|
-
* @param {String} message
|
614
|
-
* @api public
|
615
|
-
*/
|
616
|
-
|
617
|
-
assert.instanceOf = function (val, type, msg) {
|
618
|
-
new Assertion(val, msg).to.be.instanceOf(type);
|
619
|
-
};
|
620
|
-
|
621
|
-
/**
|
622
|
-
* ### .notInstanceOf(object, constructor, [message])
|
623
|
-
*
|
624
|
-
* Asserts `value` is not an instance of `constructor`.
|
625
|
-
*
|
626
|
-
* var Tea = function (name) { this.name = name; }
|
627
|
-
* , chai = new String('chai');
|
628
|
-
*
|
629
|
-
* assert.notInstanceOf(chai, Tea, 'chai is not an instance of tea');
|
630
|
-
*
|
631
|
-
* @name notInstanceOf
|
632
|
-
* @param {Object} object
|
633
|
-
* @param {Constructor} constructor
|
634
|
-
* @param {String} message
|
635
|
-
* @api public
|
636
|
-
*/
|
637
|
-
|
638
|
-
assert.notInstanceOf = function (val, type, msg) {
|
639
|
-
new Assertion(val, msg).to.not.be.instanceOf(type);
|
640
|
-
};
|
641
|
-
|
642
|
-
/**
|
643
|
-
* ### .include(haystack, needle, [message])
|
644
|
-
*
|
645
|
-
* Asserts that `haystack` includes `needle`. Works
|
646
|
-
* for strings and arrays.
|
647
|
-
*
|
648
|
-
* assert.include('foobar', 'bar', 'foobar contains string "bar"');
|
649
|
-
* assert.include([ 1, 2, 3 ], 3, 'array contains value');
|
650
|
-
*
|
651
|
-
* @name include
|
652
|
-
* @param {Array|String} haystack
|
653
|
-
* @param {Mixed} needle
|
654
|
-
* @param {String} message
|
655
|
-
* @api public
|
656
|
-
*/
|
657
|
-
|
658
|
-
assert.include = function (exp, inc, msg) {
|
659
|
-
new Assertion(exp, msg, assert.include).include(inc);
|
660
|
-
};
|
661
|
-
|
662
|
-
/**
|
663
|
-
* ### .notInclude(haystack, needle, [message])
|
664
|
-
*
|
665
|
-
* Asserts that `haystack` does not include `needle`. Works
|
666
|
-
* for strings and arrays.
|
667
|
-
*i
|
668
|
-
* assert.notInclude('foobar', 'baz', 'string not include substring');
|
669
|
-
* assert.notInclude([ 1, 2, 3 ], 4, 'array not include contain value');
|
670
|
-
*
|
671
|
-
* @name notInclude
|
672
|
-
* @param {Array|String} haystack
|
673
|
-
* @param {Mixed} needle
|
674
|
-
* @param {String} message
|
675
|
-
* @api public
|
676
|
-
*/
|
677
|
-
|
678
|
-
assert.notInclude = function (exp, inc, msg) {
|
679
|
-
new Assertion(exp, msg, assert.notInclude).not.include(inc);
|
680
|
-
};
|
681
|
-
|
682
|
-
/**
|
683
|
-
* ### .match(value, regexp, [message])
|
684
|
-
*
|
685
|
-
* Asserts that `value` matches the regular expression `regexp`.
|
686
|
-
*
|
687
|
-
* assert.match('foobar', /^foo/, 'regexp matches');
|
688
|
-
*
|
689
|
-
* @name match
|
690
|
-
* @param {Mixed} value
|
691
|
-
* @param {RegExp} regexp
|
692
|
-
* @param {String} message
|
693
|
-
* @api public
|
694
|
-
*/
|
695
|
-
|
696
|
-
assert.match = function (exp, re, msg) {
|
697
|
-
new Assertion(exp, msg).to.match(re);
|
698
|
-
};
|
699
|
-
|
700
|
-
/**
|
701
|
-
* ### .notMatch(value, regexp, [message])
|
702
|
-
*
|
703
|
-
* Asserts that `value` does not match the regular expression `regexp`.
|
704
|
-
*
|
705
|
-
* assert.notMatch('foobar', /^foo/, 'regexp does not match');
|
706
|
-
*
|
707
|
-
* @name notMatch
|
708
|
-
* @param {Mixed} value
|
709
|
-
* @param {RegExp} regexp
|
710
|
-
* @param {String} message
|
711
|
-
* @api public
|
712
|
-
*/
|
713
|
-
|
714
|
-
assert.notMatch = function (exp, re, msg) {
|
715
|
-
new Assertion(exp, msg).to.not.match(re);
|
716
|
-
};
|
717
|
-
|
718
|
-
/**
|
719
|
-
* ### .property(object, property, [message])
|
720
|
-
*
|
721
|
-
* Asserts that `object` has a property named by `property`.
|
722
|
-
*
|
723
|
-
* assert.property({ tea: { green: 'matcha' }}, 'tea');
|
724
|
-
*
|
725
|
-
* @name property
|
726
|
-
* @param {Object} object
|
727
|
-
* @param {String} property
|
728
|
-
* @param {String} message
|
729
|
-
* @api public
|
730
|
-
*/
|
731
|
-
|
732
|
-
assert.property = function (obj, prop, msg) {
|
733
|
-
new Assertion(obj, msg).to.have.property(prop);
|
734
|
-
};
|
735
|
-
|
736
|
-
/**
|
737
|
-
* ### .notProperty(object, property, [message])
|
738
|
-
*
|
739
|
-
* Asserts that `object` does _not_ have a property named by `property`.
|
740
|
-
*
|
741
|
-
* assert.notProperty({ tea: { green: 'matcha' }}, 'coffee');
|
742
|
-
*
|
743
|
-
* @name notProperty
|
744
|
-
* @param {Object} object
|
745
|
-
* @param {String} property
|
746
|
-
* @param {String} message
|
747
|
-
* @api public
|
748
|
-
*/
|
749
|
-
|
750
|
-
assert.notProperty = function (obj, prop, msg) {
|
751
|
-
new Assertion(obj, msg).to.not.have.property(prop);
|
752
|
-
};
|
753
|
-
|
754
|
-
/**
|
755
|
-
* ### .deepProperty(object, property, [message])
|
756
|
-
*
|
757
|
-
* Asserts that `object` has a property named by `property`, which can be a
|
758
|
-
* string using dot- and bracket-notation for deep reference.
|
759
|
-
*
|
760
|
-
* assert.deepProperty({ tea: { green: 'matcha' }}, 'tea.green');
|
761
|
-
*
|
762
|
-
* @name deepProperty
|
763
|
-
* @param {Object} object
|
764
|
-
* @param {String} property
|
765
|
-
* @param {String} message
|
766
|
-
* @api public
|
767
|
-
*/
|
768
|
-
|
769
|
-
assert.deepProperty = function (obj, prop, msg) {
|
770
|
-
new Assertion(obj, msg).to.have.deep.property(prop);
|
771
|
-
};
|
772
|
-
|
773
|
-
/**
|
774
|
-
* ### .notDeepProperty(object, property, [message])
|
775
|
-
*
|
776
|
-
* Asserts that `object` does _not_ have a property named by `property`, which
|
777
|
-
* can be a string using dot- and bracket-notation for deep reference.
|
778
|
-
*
|
779
|
-
* assert.notDeepProperty({ tea: { green: 'matcha' }}, 'tea.oolong');
|
780
|
-
*
|
781
|
-
* @name notDeepProperty
|
782
|
-
* @param {Object} object
|
783
|
-
* @param {String} property
|
784
|
-
* @param {String} message
|
785
|
-
* @api public
|
786
|
-
*/
|
787
|
-
|
788
|
-
assert.notDeepProperty = function (obj, prop, msg) {
|
789
|
-
new Assertion(obj, msg).to.not.have.deep.property(prop);
|
790
|
-
};
|
791
|
-
|
792
|
-
/**
|
793
|
-
* ### .propertyVal(object, property, value, [message])
|
794
|
-
*
|
795
|
-
* Asserts that `object` has a property named by `property` with value given
|
796
|
-
* by `value`.
|
797
|
-
*
|
798
|
-
* assert.propertyVal({ tea: 'is good' }, 'tea', 'is good');
|
799
|
-
*
|
800
|
-
* @name propertyVal
|
801
|
-
* @param {Object} object
|
802
|
-
* @param {String} property
|
803
|
-
* @param {Mixed} value
|
804
|
-
* @param {String} message
|
805
|
-
* @api public
|
806
|
-
*/
|
807
|
-
|
808
|
-
assert.propertyVal = function (obj, prop, val, msg) {
|
809
|
-
new Assertion(obj, msg).to.have.property(prop, val);
|
810
|
-
};
|
811
|
-
|
812
|
-
/**
|
813
|
-
* ### .propertyNotVal(object, property, value, [message])
|
814
|
-
*
|
815
|
-
* Asserts that `object` has a property named by `property`, but with a value
|
816
|
-
* different from that given by `value`.
|
817
|
-
*
|
818
|
-
* assert.propertyNotVal({ tea: 'is good' }, 'tea', 'is bad');
|
819
|
-
*
|
820
|
-
* @name propertyNotVal
|
821
|
-
* @param {Object} object
|
822
|
-
* @param {String} property
|
823
|
-
* @param {Mixed} value
|
824
|
-
* @param {String} message
|
825
|
-
* @api public
|
826
|
-
*/
|
827
|
-
|
828
|
-
assert.propertyNotVal = function (obj, prop, val, msg) {
|
829
|
-
new Assertion(obj, msg).to.not.have.property(prop, val);
|
830
|
-
};
|
831
|
-
|
832
|
-
/**
|
833
|
-
* ### .deepPropertyVal(object, property, value, [message])
|
834
|
-
*
|
835
|
-
* Asserts that `object` has a property named by `property` with value given
|
836
|
-
* by `value`. `property` can use dot- and bracket-notation for deep
|
837
|
-
* reference.
|
838
|
-
*
|
839
|
-
* assert.deepPropertyVal({ tea: { green: 'matcha' }}, 'tea.green', 'matcha');
|
840
|
-
*
|
841
|
-
* @name deepPropertyVal
|
842
|
-
* @param {Object} object
|
843
|
-
* @param {String} property
|
844
|
-
* @param {Mixed} value
|
845
|
-
* @param {String} message
|
846
|
-
* @api public
|
847
|
-
*/
|
848
|
-
|
849
|
-
assert.deepPropertyVal = function (obj, prop, val, msg) {
|
850
|
-
new Assertion(obj, msg).to.have.deep.property(prop, val);
|
851
|
-
};
|
852
|
-
|
853
|
-
/**
|
854
|
-
* ### .deepPropertyNotVal(object, property, value, [message])
|
855
|
-
*
|
856
|
-
* Asserts that `object` has a property named by `property`, but with a value
|
857
|
-
* different from that given by `value`. `property` can use dot- and
|
858
|
-
* bracket-notation for deep reference.
|
859
|
-
*
|
860
|
-
* assert.deepPropertyNotVal({ tea: { green: 'matcha' }}, 'tea.green', 'konacha');
|
861
|
-
*
|
862
|
-
* @name deepPropertyNotVal
|
863
|
-
* @param {Object} object
|
864
|
-
* @param {String} property
|
865
|
-
* @param {Mixed} value
|
866
|
-
* @param {String} message
|
867
|
-
* @api public
|
868
|
-
*/
|
869
|
-
|
870
|
-
assert.deepPropertyNotVal = function (obj, prop, val, msg) {
|
871
|
-
new Assertion(obj, msg).to.not.have.deep.property(prop, val);
|
872
|
-
};
|
873
|
-
|
874
|
-
/**
|
875
|
-
* ### .lengthOf(object, length, [message])
|
876
|
-
*
|
877
|
-
* Asserts that `object` has a `length` property with the expected value.
|
878
|
-
*
|
879
|
-
* assert.lengthOf([1,2,3], 3, 'array has length of 3');
|
880
|
-
* assert.lengthOf('foobar', 5, 'string has length of 6');
|
881
|
-
*
|
882
|
-
* @name lengthOf
|
883
|
-
* @param {Mixed} object
|
884
|
-
* @param {Number} length
|
885
|
-
* @param {String} message
|
886
|
-
* @api public
|
887
|
-
*/
|
888
|
-
|
889
|
-
assert.lengthOf = function (exp, len, msg) {
|
890
|
-
new Assertion(exp, msg).to.have.length(len);
|
891
|
-
};
|
892
|
-
|
893
|
-
/**
|
894
|
-
* ### .throws(function, [constructor/string/regexp], [string/regexp], [message])
|
895
|
-
*
|
896
|
-
* Asserts that `function` will throw an error that is an instance of
|
897
|
-
* `constructor`, or alternately that it will throw an error with message
|
898
|
-
* matching `regexp`.
|
899
|
-
*
|
900
|
-
* assert.throw(fn, 'function throws a reference error');
|
901
|
-
* assert.throw(fn, /function throws a reference error/);
|
902
|
-
* assert.throw(fn, ReferenceError);
|
903
|
-
* assert.throw(fn, ReferenceError, 'function throws a reference error');
|
904
|
-
* assert.throw(fn, ReferenceError, /function throws a reference error/);
|
905
|
-
*
|
906
|
-
* @name throws
|
907
|
-
* @alias throw
|
908
|
-
* @alias Throw
|
909
|
-
* @param {Function} function
|
910
|
-
* @param {ErrorConstructor} constructor
|
911
|
-
* @param {RegExp} regexp
|
912
|
-
* @param {String} message
|
913
|
-
* @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
|
914
|
-
* @api public
|
915
|
-
*/
|
916
|
-
|
917
|
-
assert.Throw = function (fn, errt, errs, msg) {
|
918
|
-
if ('string' === typeof errt || errt instanceof RegExp) {
|
919
|
-
errs = errt;
|
920
|
-
errt = null;
|
921
|
-
}
|
922
|
-
|
923
|
-
var assertErr = new Assertion(fn, msg).to.Throw(errt, errs);
|
924
|
-
return flag(assertErr, 'object');
|
925
|
-
};
|
926
|
-
|
927
|
-
/**
|
928
|
-
* ### .doesNotThrow(function, [constructor/regexp], [message])
|
929
|
-
*
|
930
|
-
* Asserts that `function` will _not_ throw an error that is an instance of
|
931
|
-
* `constructor`, or alternately that it will not throw an error with message
|
932
|
-
* matching `regexp`.
|
933
|
-
*
|
934
|
-
* assert.doesNotThrow(fn, Error, 'function does not throw');
|
935
|
-
*
|
936
|
-
* @name doesNotThrow
|
937
|
-
* @param {Function} function
|
938
|
-
* @param {ErrorConstructor} constructor
|
939
|
-
* @param {RegExp} regexp
|
940
|
-
* @param {String} message
|
941
|
-
* @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
|
942
|
-
* @api public
|
943
|
-
*/
|
944
|
-
|
945
|
-
assert.doesNotThrow = function (fn, type, msg) {
|
946
|
-
if ('string' === typeof type) {
|
947
|
-
msg = type;
|
948
|
-
type = null;
|
949
|
-
}
|
950
|
-
|
951
|
-
new Assertion(fn, msg).to.not.Throw(type);
|
952
|
-
};
|
953
|
-
|
954
|
-
/**
|
955
|
-
* ### .operator(val1, operator, val2, [message])
|
956
|
-
*
|
957
|
-
* Compares two values using `operator`.
|
958
|
-
*
|
959
|
-
* assert.operator(1, '<', 2, 'everything is ok');
|
960
|
-
* assert.operator(1, '>', 2, 'this will fail');
|
961
|
-
*
|
962
|
-
* @name operator
|
963
|
-
* @param {Mixed} val1
|
964
|
-
* @param {String} operator
|
965
|
-
* @param {Mixed} val2
|
966
|
-
* @param {String} message
|
967
|
-
* @api public
|
968
|
-
*/
|
969
|
-
|
970
|
-
assert.operator = function (val, operator, val2, msg) {
|
971
|
-
if (!~['==', '===', '>', '>=', '<', '<=', '!=', '!=='].indexOf(operator)) {
|
972
|
-
throw new Error('Invalid operator "' + operator + '"');
|
973
|
-
}
|
974
|
-
var test = new Assertion(eval(val + operator + val2), msg);
|
975
|
-
test.assert(
|
976
|
-
true === flag(test, 'object')
|
977
|
-
, 'expected ' + util.inspect(val) + ' to be ' + operator + ' ' + util.inspect(val2)
|
978
|
-
, 'expected ' + util.inspect(val) + ' to not be ' + operator + ' ' + util.inspect(val2) );
|
979
|
-
};
|
980
|
-
|
981
|
-
/**
|
982
|
-
* ### .closeTo(actual, expected, delta, [message])
|
983
|
-
*
|
984
|
-
* Asserts that the target is equal `expected`, to within a +/- `delta` range.
|
985
|
-
*
|
986
|
-
* assert.closeTo(1.5, 1, 0.5, 'numbers are close');
|
987
|
-
*
|
988
|
-
* @name closeTo
|
989
|
-
* @param {Number} actual
|
990
|
-
* @param {Number} expected
|
991
|
-
* @param {Number} delta
|
992
|
-
* @param {String} message
|
993
|
-
* @api public
|
994
|
-
*/
|
995
|
-
|
996
|
-
assert.closeTo = function (act, exp, delta, msg) {
|
997
|
-
new Assertion(act, msg).to.be.closeTo(exp, delta);
|
998
|
-
};
|
999
|
-
|
1000
|
-
/**
|
1001
|
-
* ### .sameMembers(set1, set2, [message])
|
1002
|
-
*
|
1003
|
-
* Asserts that `set1` and `set2` have the same members.
|
1004
|
-
* Order is not taken into account.
|
1005
|
-
*
|
1006
|
-
* assert.sameMembers([ 1, 2, 3 ], [ 2, 1, 3 ], 'same members');
|
1007
|
-
*
|
1008
|
-
* @name sameMembers
|
1009
|
-
* @param {Array} superset
|
1010
|
-
* @param {Array} subset
|
1011
|
-
* @param {String} message
|
1012
|
-
* @api public
|
1013
|
-
*/
|
1014
|
-
|
1015
|
-
assert.sameMembers = function (set1, set2, msg) {
|
1016
|
-
new Assertion(set1, msg).to.have.same.members(set2);
|
1017
|
-
}
|
1018
|
-
|
1019
|
-
/**
|
1020
|
-
* ### .includeMembers(superset, subset, [message])
|
1021
|
-
*
|
1022
|
-
* Asserts that `subset` is included in `superset`.
|
1023
|
-
* Order is not taken into account.
|
1024
|
-
*
|
1025
|
-
* assert.includeMembers([ 1, 2, 3 ], [ 2, 1 ], 'include members');
|
1026
|
-
*
|
1027
|
-
* @name includeMembers
|
1028
|
-
* @param {Array} superset
|
1029
|
-
* @param {Array} subset
|
1030
|
-
* @param {String} message
|
1031
|
-
* @api public
|
1032
|
-
*/
|
1033
|
-
|
1034
|
-
assert.includeMembers = function (superset, subset, msg) {
|
1035
|
-
new Assertion(superset, msg).to.include.members(subset);
|
1036
|
-
}
|
1037
|
-
|
1038
|
-
/*!
|
1039
|
-
* Undocumented / untested
|
1040
|
-
*/
|
1041
|
-
|
1042
|
-
assert.ifError = function (val, msg) {
|
1043
|
-
new Assertion(val, msg).to.not.be.ok;
|
1044
|
-
};
|
1045
|
-
|
1046
|
-
/*!
|
1047
|
-
* Aliases.
|
1048
|
-
*/
|
1049
|
-
|
1050
|
-
(function alias(name, as){
|
1051
|
-
assert[as] = assert[name];
|
1052
|
-
return alias;
|
1053
|
-
})
|
1054
|
-
('Throw', 'throw')
|
1055
|
-
('Throw', 'throws');
|
1056
|
-
};
|