Skip to content

Commit 2de1f3e

Browse files
refactor use of global with sinon in ClassificationQueue
1 parent 8ecda5d commit 2de1f3e

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

packages/lib-classifier/src/store/utils/ClassificationQueue.spec.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,14 @@ describe('ClassificationQueue', function () {
109109
})
110110

111111
describe('keeps classifications in localStorage if backend fails', function () {
112-
let clock
113-
114112
before(function () {
115-
clock = sinon.useFakeTimers({ global })
113+
sinon.stub(global, 'setTimeout').callsFake(() => 100)
114+
sinon.stub(global, 'clearTimeout')
116115
})
117116

118117
after(function () {
119-
clock.restore()
118+
global.setTimeout.restore()
119+
global.clearTimeout.restore()
120120
})
121121

122122
beforeEach(function () {
@@ -166,14 +166,14 @@ describe('ClassificationQueue', function () {
166166
})
167167

168168
describe('with invalid classifications', function () {
169-
let clock
170-
171169
before(function () {
172-
clock = sinon.useFakeTimers({ global })
170+
sinon.stub(global, 'setTimeout').callsFake(() => 100)
171+
sinon.stub(global, 'clearTimeout')
173172
})
174173

175174
after(function () {
176-
clock.restore()
175+
global.setTimeout.restore()
176+
global.clearTimeout.restore()
177177
})
178178

179179
beforeEach(function () {

0 commit comments

Comments
 (0)