aboutsummaryrefslogtreecommitdiff
path: root/test/handleInput.js
diff options
context:
space:
mode:
authorXhmikosR <[email protected]>2020-04-24 20:40:09 +0300
committerGitHub <[email protected]>2020-04-24 10:40:09 -0700
commiteb6dc35294715ef07639eb93e6961861d05a1f67 (patch)
treedf50a0b8db0b6206044daddcc2933225235eb6c7 /test/handleInput.js
parent844d7658677c1422e98648b8727cd421d1a83e02 (diff)
downloadnode-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.js22
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');