Skip to content

Commit

Permalink
Avoid the 'was called with' assertion
Browse files Browse the repository at this point in the history
It has been deprecated for two years and will soon display
warnings or even be removed.

unexpectedjs/unexpected-sinon#32
  • Loading branch information
papandreou committed Jan 19, 2019
1 parent 6b5a785 commit 6a597cf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
13 changes: 9 additions & 4 deletions test/node-unit/cli/options.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ describe('options', function() {
try {
loadOptions(`--opts ${opts}`);
} catch (ignored) {}
expect(readFileSync, 'was called with', opts, 'utf8');
expect(readFileSync, 'to have a call satisfying', [opts, 'utf8']);
});

it('should throw', function() {
Expand Down Expand Up @@ -151,7 +151,10 @@ describe('options', function() {
});

it('should attempt to load default mocha.opts', function() {
expect(readFileSync, 'was called with', defaults.opts, 'utf8');
expect(readFileSync, 'to have a call satisfying', [
defaults.opts,
'utf8'
]);
});

it('should set opts = false', function() {
Expand Down Expand Up @@ -514,7 +517,7 @@ describe('options', function() {
try {
loadOptions(`--config ${config}`);
} catch (ignored) {}
expect(loadConfig, 'was called with', config);
expect(loadConfig, 'to have a call satisfying', [config]);
});

it('should throw to warn the user', function() {
Expand Down Expand Up @@ -555,7 +558,9 @@ describe('options', function() {
});

it('should attempt to load file at found path', function() {
expect(loadConfig, 'was called with', '/some/.mocharc.json');
expect(loadConfig, 'to have a call satisfying', [
'/some/.mocharc.json'
]);
});

it('should set config = false', function() {
Expand Down
4 changes: 2 additions & 2 deletions test/unit/mocha.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ describe('Mocha', function() {
it('should prefer "color" over "useColors"', function() {
// eslint-disable-next-line no-new
new Mocha({useColors: true, color: false});
expect(Mocha.prototype.useColors, 'was called with', false);
expect(Mocha.prototype.useColors, 'to have a call satisfying', [false]);
});

it('should assign "useColors" to "color"', function() {
// eslint-disable-next-line no-new
new Mocha({useColors: true});
expect(Mocha.prototype.useColors, 'was called with', true);
expect(Mocha.prototype.useColors, 'to have a call satisfying', [true]);
});

it('should call utils.deprecate()', function() {
Expand Down

0 comments on commit 6a597cf

Please sign in to comment.