diff --git a/package.json b/package.json index c56bd91..f36a540 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "jscs": "^2.6.0", "jscs-preset-hexo": "^1.0.1", "mocha": "^2.3.4", - "sinon": "^1.17.3", + "sinon": "^7.0.0", "supertest": "^1.2.0", "supertest-promised": "^1.0.0", "uuid": "^2.0.1" diff --git a/test/index.js b/test/index.js index fccfe79..5595f81 100644 --- a/test/index.js +++ b/test/index.js @@ -233,23 +233,25 @@ describe('server', function() { it('display localhost instead of 0.0.0.0', function() { var spy = sinon.spy(); - sinon.stub(hexo.log, 'info', spy); + var stub = sinon.stub(hexo.log, 'info'); + stub.callsFake(spy); return Promise.using(prepareServer(), function(app) { spy.args[1][1].should.contain('localhost'); }).finally(function() { - hexo.log.info.restore(); + stub.restore(); }); }); it('display localhost instead of [::]', function() { var spy = sinon.spy(); - sinon.stub(hexo.log, 'info', spy); + var stub = sinon.stub(hexo.log, 'info'); + stub.callsFake(spy); return Promise.using(prepareServer({ip: '::'}), function(app) { spy.args[1][1].should.contain('localhost'); }).finally(function() { - hexo.log.info.restore(); + stub.restore(); }); }); });