Skip to content

Commit

Permalink
Added tests for better parameter list diffs.
Browse files Browse the repository at this point in the history
  • Loading branch information
papandreou committed Nov 17, 2015
1 parent 129eebc commit 11fac7e
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions test/unexpected-sinon.spec.js
Expand Up @@ -441,6 +441,40 @@ describe('unexpected-sinon', function () {
"]"
);
});

it('renders a nice diff for extraneous arguments', function () {
expect(function () {
spy('a', 'b', 'c');
expect(spy, 'was always called with exactly', 'a', 'c');
}, 'to throw exception',
"expected spy1 was always called with exactly 'a', 'c'\n" +
"\n" +
"[\n" +
" spy1(\n" +
" 'a',\n" +
" 'b', // should be removed\n" +
" 'c'\n" +
" ) at theFunction (theFileName:xx:yy)\n" +
"]"
);
});

it('renders a nice diff for missing arguments', function () {
expect(function () {
spy('a', 'c');
expect(spy, 'was always called with exactly', 'a', 'b', 'c');
}, 'to throw exception',
"expected spy1 was always called with exactly 'a', 'b', 'c'\n" +
"\n" +
"[\n" +
" spy1(\n" +
" 'a',\n" +
" // missing 'b'\n" +
" 'c'\n" +
" ) at theFunction (theFileName:xx:yy)\n" +
"]"
);
});
});

describe('was never called with', function () {
Expand Down

0 comments on commit 11fac7e

Please sign in to comment.