Skip to content

Commit

Permalink
Code style fixes related to function for value on inc, dec and changes
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfcosta committed Feb 1, 2016
1 parent e07edad commit bea1f28
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/chai/interface/assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -1363,7 +1363,7 @@ module.exports = function (chai, util) {

assert.changes = function (fn, obj, prop, msg) {
if (arguments.length === 3 && typeof obj === 'function') {
msg = prop
msg = prop;
prop = null;
}

Expand Down
10 changes: 5 additions & 5 deletions test/assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -873,18 +873,18 @@ describe('assert', function () {

it('change', function() {
var obj = { value: 10, str: 'foo' },
laughs = ['lol', 'haha'],
heroes = ['spiderman', 'superman'],
fn = function() { obj.value += 5 },
bangFn = function() { obj.str += '!' },
smFn = function() { 'foo' + 'bar' },
addFn = function() { laughs.push('hue') },
getFn = function() { return laughs.length };
batFn = function() { heroes.push('batman') },
lenFn = function() { return heroes.length };

assert.changes(fn, obj, 'value');
assert.doesNotChange(smFn, obj, 'value');
assert.changes(bangFn, obj, 'str');
assert.changes(addFn, getFn);
assert.doesNotChange(smFn, getFn);
assert.changes(batFn, lenFn);
assert.doesNotChange(smFn, lenFn);
});

it('increase, decrease', function() {
Expand Down
8 changes: 4 additions & 4 deletions test/should.js
Original file line number Diff line number Diff line change
Expand Up @@ -950,20 +950,20 @@ describe('should', function() {

it('change', function() {
var obj = { value: 10, str: 'foo' },
fruits = ['apple', 'pear'],
heroes = ['spiderman', 'superman'],
fn = function() { obj.value += 5 },
sameFn = function() { obj.value += 0 },
decFn = function() { obj.value -= 3 },
bangFn = function() { obj.str += '!' },
nanaFn = function() { fruits.push('banana') },
lenFn = function() { return fruits.length },
batFn = function() { heroes.push('batman') },
lenFn = function() { return heroes.length },
noFn = function() { return null };

fn.should.change(obj, 'value');
sameFn.should.not.change(obj, 'value');
sameFn.should.not.change(obj, 'str');
bangFn.should.change(obj, 'str');
nanaFn.should.change(lenFn);
batFn.should.change(lenFn);
noFn.should.not.change(lenFn);
});

Expand Down

0 comments on commit bea1f28

Please sign in to comment.