diff options
| author | XhmikosR <[email protected]> | 2020-04-24 20:40:09 +0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-04-24 10:40:09 -0700 |
| commit | eb6dc35294715ef07639eb93e6961861d05a1f67 (patch) | |
| tree | df50a0b8db0b6206044daddcc2933225235eb6c7 /test/handleInput.js | |
| parent | 844d7658677c1422e98648b8727cd421d1a83e02 (diff) | |
| download | node-coveralls-eb6dc35294715ef07639eb93e6961861d05a1f67.tar.xz node-coveralls-eb6dc35294715ef07639eb93e6961861d05a1f67.zip | |
Update sinon to v7.5.0. (#288)
Co-authored-by: Xavier <[email protected]>
Diffstat (limited to 'test/handleInput.js')
| -rw-r--r-- | test/handleInput.js | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/test/handleInput.js b/test/handleInput.js index c46aa17..6d4fc1e 100644 --- a/test/handleInput.js +++ b/test/handleInput.js @@ -3,7 +3,7 @@ const fs = require('fs'); const sysPath = require('path'); const should = require('should'); -const sinon = require('sinon-restore'); +const sinon = require('sinon').sandbox.create(); const logDriver = require('log-driver'); const index = require('..'); @@ -11,10 +11,10 @@ logDriver({ level: false }); describe('handleInput', () => { afterEach(() => { - sinon.restoreAll(); + sinon.restore(); }); it('returns an error when there\'s an error getting options', done => { - sinon.stub(index, 'getOptions', cb => cb('some error', {})); + sinon.stub(index, 'getOptions').callsFake(cb => cb('some error', {})); const path = sysPath.join(__dirname, './fixtures/onefile.lcov'); const input = fs.readFileSync(path, 'utf8'); index.handleInput(input, err => { @@ -23,8 +23,8 @@ describe('handleInput', () => { }); }); it('returns an error when there\'s an error converting', done => { - sinon.stub(index, 'getOptions', cb => cb(null, {})); - sinon.stub(index, 'convertLcovToCoveralls', (input, options, cb) => { + sinon.stub(index, 'getOptions').callsFake(cb => cb(null, {})); + sinon.stub(index, 'convertLcovToCoveralls').callsFake((input, options, cb) => { cb('some error'); }); const path = sysPath.join(__dirname, './fixtures/onefile.lcov'); @@ -35,8 +35,8 @@ describe('handleInput', () => { }); }); it('returns an error when there\'s an error sending', done => { - sinon.stub(index, 'getOptions', cb => cb(null, {})); - sinon.stub(index, 'sendToCoveralls', (postData, cb) => { + sinon.stub(index, 'getOptions').callsFake(cb => cb(null, {})); + sinon.stub(index, 'sendToCoveralls').callsFake((postData, cb) => { cb('some error'); }); const path = sysPath.join(__dirname, './fixtures/onefile.lcov'); @@ -47,8 +47,8 @@ describe('handleInput', () => { }); }); it('returns an error when there\'s a bad status code', done => { - sinon.stub(index, 'getOptions', cb => cb(null, {})); - sinon.stub(index, 'sendToCoveralls', (postData, cb) => { + sinon.stub(index, 'getOptions').callsFake(cb => cb(null, {})); + sinon.stub(index, 'sendToCoveralls').callsFake((postData, cb) => { cb(null, { statusCode: 500 }, 'body'); }); const path = sysPath.join(__dirname, './fixtures/onefile.lcov'); @@ -59,8 +59,8 @@ describe('handleInput', () => { }); }); it('completes successfully when there are no errors', done => { - sinon.stub(index, 'getOptions', cb => cb(null, {})); - sinon.stub(index, 'sendToCoveralls', (postData, cb) => { + sinon.stub(index, 'getOptions').callsFake(cb => cb(null, {})); + sinon.stub(index, 'sendToCoveralls').callsFake((postData, cb) => { cb(null, { statusCode: 200 }, 'body'); }); const path = sysPath.join(__dirname, './fixtures/onefile.lcov'); |
