mirror of
https://github.com/chaijs/chai
synced 2024-11-15 00:07:11 +00:00
assert tests for change
,increase
,decrease
This commit is contained in:
parent
c44a5133f9
commit
be67119616
1 changed files with 24 additions and 0 deletions
|
@ -689,4 +689,28 @@ describe('assert', function () {
|
|||
}, 'expected [ { b: 3 } ] to have the same members as [ { b: 5 } ]');
|
||||
});
|
||||
|
||||
it('change', function() {
|
||||
var obj = { value: 10 },
|
||||
fn = function() { obj.value += 5 },
|
||||
smFn = function() { 'foo' + 'bar' };
|
||||
|
||||
assert.changes(fn, obj, 'value');
|
||||
assert.doesNotChange(smFn, obj, 'value');
|
||||
});
|
||||
|
||||
it('increase, decrease', function() {
|
||||
var obj = { value: 10 },
|
||||
incFn = function() { obj.value += 2 },
|
||||
decFn = function() { obj.value -= 3 },
|
||||
smFn = function() { obj.value += 0 };
|
||||
|
||||
assert.decreases(decFn, obj, 'value');
|
||||
assert.decreasesBy(decFn, obj, 'value', 3);
|
||||
assert.doesNotDecrease(smFn, obj, 'value');
|
||||
|
||||
assert.increases(incFn, obj, 'value');
|
||||
assert.increasesBy(incFn, obj, 'value', 2);
|
||||
assert.doesNotIncrease(smFn, obj, 'value');
|
||||
});
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue