Skip to content

Commit 96bccad

Browse files
remove sinon
1 parent 27c391f commit 96bccad

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
"eslint-plugin-standard": "4.1.0",
2929
"mocha": "9.2.2",
3030
"nyc": "15.1.0",
31-
"sinon": "3.3.0",
3231
"supertest": "6.2.3"
3332
},
3433
"files": [

test/compression.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ var crypto = require('crypto')
66
var http = require('http')
77
var request = require('supertest')
88
var zlib = require('zlib')
9-
var sinon = require('sinon')
109

1110
var compression = require('..')
1211

@@ -149,9 +148,11 @@ describe('compression()', function () {
149148
})
150149

151150
it('res.write() should call callback with error after end', function (done) {
152-
var onError = sinon.spy(function (err) {
151+
var onErrorCalled = false
152+
var onError = function (err) {
153153
assert.ok(err.code === 'ERR_STREAM_WRITE_AFTER_END')
154-
})
154+
onErrorCalled = true
155+
}
155156

156157
var server = createServer({ threshold: 0 }, function (req, res) {
157158
res.setHeader('Content-Type', 'text/plain')
@@ -160,7 +161,7 @@ describe('compression()', function () {
160161
res.write('hello, world', onError)
161162

162163
process.nextTick(function () {
163-
assert.ok(onError.callCount > 0)
164+
assert.ok(onErrorCalled)
164165
})
165166
})
166167

@@ -597,9 +598,11 @@ describe('compression()', function () {
597598
})
598599

599600
it('should return false writing after end', function (done) {
600-
var onError = sinon.spy(function (err) {
601+
var onErrorCalled = false
602+
var onError = function (err) {
601603
assert.ok(err.code === 'ERR_STREAM_WRITE_AFTER_END')
602-
})
604+
onErrorCalled = true
605+
}
603606

604607
var server = createServer({ threshold: 0 }, function (req, res) {
605608
res.on('error', onError)
@@ -610,7 +613,7 @@ describe('compression()', function () {
610613
assert.ok(res.write('', onError) === false)
611614

612615
process.nextTick(function () {
613-
assert.ok(onError.callCount > 0)
616+
assert.ok(onErrorCalled)
614617
})
615618
})
616619

0 commit comments

Comments
 (0)