From 6a597cfe3164092d78c4beba8ac8cfca203c0b3d Mon Sep 17 00:00:00 2001 From: Andreas Lind Date: Sat, 19 Jan 2019 17:13:54 +0100 Subject: [PATCH] Avoid the 'was called with' assertion It has been deprecated for two years and will soon display warnings or even be removed. https://github.com/unexpectedjs/unexpected-sinon/issues/32 --- test/node-unit/cli/options.spec.js | 13 +++++++++---- test/unit/mocha.spec.js | 4 ++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/test/node-unit/cli/options.spec.js b/test/node-unit/cli/options.spec.js index 0bf6b2fc72..eba791ddea 100644 --- a/test/node-unit/cli/options.spec.js +++ b/test/node-unit/cli/options.spec.js @@ -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() { @@ -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() { @@ -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() { @@ -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() { diff --git a/test/unit/mocha.spec.js b/test/unit/mocha.spec.js index 5cb6319d4d..580533622c 100644 --- a/test/unit/mocha.spec.js +++ b/test/unit/mocha.spec.js @@ -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() {