Skip to content

Commit 27688bc

Browse files
papandreouboneskull
authored andcommitted
Avoid the 'was called with' assertion
It has been deprecated for two years and will soon display warnings or even be removed. unexpectedjs/unexpected-sinon#32
1 parent 57930a2 commit 27688bc

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

test/node-unit/cli/options.spec.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ describe('options', function() {
114114
try {
115115
loadOptions(`--opts ${opts}`);
116116
} catch (ignored) {}
117-
expect(readFileSync, 'was called with', opts, 'utf8');
117+
expect(readFileSync, 'to have a call satisfying', [opts, 'utf8']);
118118
});
119119

120120
it('should throw', function() {
@@ -151,7 +151,10 @@ describe('options', function() {
151151
});
152152

153153
it('should attempt to load default mocha.opts', function() {
154-
expect(readFileSync, 'was called with', defaults.opts, 'utf8');
154+
expect(readFileSync, 'to have a call satisfying', [
155+
defaults.opts,
156+
'utf8'
157+
]);
155158
});
156159

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

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

557560
it('should attempt to load file at found path', function() {
558-
expect(loadConfig, 'was called with', '/some/.mocharc.json');
561+
expect(loadConfig, 'to have a call satisfying', [
562+
'/some/.mocharc.json'
563+
]);
559564
});
560565

561566
it('should set config = false', function() {

test/unit/mocha.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ describe('Mocha', function() {
2424
it('should prefer "color" over "useColors"', function() {
2525
// eslint-disable-next-line no-new
2626
new Mocha({useColors: true, color: false});
27-
expect(Mocha.prototype.useColors, 'was called with', false);
27+
expect(Mocha.prototype.useColors, 'to have a call satisfying', [false]);
2828
});
2929

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

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

0 commit comments

Comments
 (0)