From 1c6a54f1c90faa161f93268f55efdc7b7d44d361 Mon Sep 17 00:00:00 2001 From: Jan Romann Date: Sun, 21 Apr 2024 16:44:45 +0200 Subject: [PATCH] fixup! refactor: simply use of siinon fake timers --- test/proxy.ts | 2 +- test/server.ts | 9 ++++----- test/share-socket.ts | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/test/proxy.ts b/test/proxy.ts index 38305415..f7f48ad6 100644 --- a/test/proxy.ts +++ b/test/proxy.ts @@ -26,7 +26,7 @@ describe('proxy', function () { let targetPort: number beforeEach(function (done) { - clock = sinon.useFakeTimers() + clock = sinon.useFakeTimers({ shouldClearNativeTimers: true }) port = nextPort() server = createServer({ proxy: true diff --git a/test/server.ts b/test/server.ts index 5d7ea456..15fa4a6e 100644 --- a/test/server.ts +++ b/test/server.ts @@ -32,7 +32,7 @@ describe('server', function () { port = nextPort() server = createServer() server.listen(port, done) - clock = sinon.useFakeTimers() + clock = sinon.useFakeTimers({ shouldClearNativeTimers: true }) }) beforeEach(function (done) { @@ -535,7 +535,6 @@ describe('server', function () { }) it.skip('should calculate the response twice after the interval', function (done) { - clock = sinon.useFakeTimers() let first = true const delay = (parameters.exchangeLifetime * 1000) + 1 @@ -1181,7 +1180,7 @@ describe('server LRU', function () { } beforeEach(function (done) { - clock = sinon.useFakeTimers() + clock = sinon.useFakeTimers({ shouldClearNativeTimers: true }) port = nextPort() server = createServer() server.listen(port, done) @@ -1236,7 +1235,7 @@ describe('server block cache', function () { } beforeEach(function (done) { - clock = sinon.useFakeTimers() + clock = sinon.useFakeTimers({ shouldClearNativeTimers: true }) port = nextPort() server = createServer() server.listen(port, done) @@ -1297,7 +1296,7 @@ describe('Client Identifier', function () { } beforeEach(function (done) { - clock = sinon.useFakeTimers() + clock = sinon.useFakeTimers({ shouldClearNativeTimers: true }) port = nextPort() server = createServer({ diff --git a/test/share-socket.ts b/test/share-socket.ts index 69373f3a..bc096e23 100644 --- a/test/share-socket.ts +++ b/test/share-socket.ts @@ -437,7 +437,7 @@ describe('share-socket', function () { }) it('should error after ~247 seconds', function (done) { - const clock = sinon.useFakeTimers() + const clock = sinon.useFakeTimers({ shouldClearNativeTimers: true }) const req = request(`coap://localhost:${port + 1}`) req.end()