aboutsummaryrefslogtreecommitdiff
path: root/test
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
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')
-rw-r--r--test/handleInput.js22
-rw-r--r--test/sendToCoveralls.js8
2 files changed, 15 insertions, 15 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');
diff --git a/test/sendToCoveralls.js b/test/sendToCoveralls.js
index 2f18880..f114516 100644
--- a/test/sendToCoveralls.js
+++ b/test/sendToCoveralls.js
@@ -2,7 +2,7 @@
const should = require('should');
const request = require('request');
-const sinon = require('sinon-restore');
+const sinon = require('sinon').sandbox.create();
const logDriver = require('log-driver');
const index = require('..');
@@ -15,7 +15,7 @@ describe('sendToCoveralls', () => {
});
afterEach(() => {
- sinon.restoreAll();
+ sinon.restore();
if (realCoverallsHost !== undefined) {
process.env.COVERALLS_ENDPOINT = realCoverallsHost;
} else {
@@ -24,7 +24,7 @@ describe('sendToCoveralls', () => {
});
it('passes on the correct params to request.post', done => {
- sinon.stub(request, 'post', (obj, cb) => {
+ sinon.stub(request, 'post').callsFake((obj, cb) => {
obj.url.should.equal('https://coveralls.io/api/v1/jobs');
obj.form.should.eql({ json: '{"some":"obj"}' });
cb('err', 'response', 'body');
@@ -42,7 +42,7 @@ describe('sendToCoveralls', () => {
it('allows sending to enterprise url', done => {
process.env.COVERALLS_ENDPOINT = 'https://coveralls-ubuntu.domain.com';
- sinon.stub(request, 'post', (obj, cb) => {
+ sinon.stub(request, 'post').callsFake((obj, cb) => {
obj.url.should.equal('https://coveralls-ubuntu.domain.com/api/v1/jobs');
obj.form.should.eql({ json: '{"some":"obj"}' });
cb('err', 'response', 'body');