From cf5d7d9d942a13b0a55427367740885defc26469 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 20 Mar 2020 16:17:14 +0100 Subject: Try to fix tracker tests issues --- server/tests/api/server/tracker.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'server/tests') diff --git a/server/tests/api/server/tracker.ts b/server/tests/api/server/tracker.ts index 611d5254a..5b56a83bb 100644 --- a/server/tests/api/server/tracker.ts +++ b/server/tests/api/server/tracker.ts @@ -73,6 +73,8 @@ describe('Test tracker', function () { it('Should disable the tracker', function (done) { this.timeout(20000) + const errCb = () => done(new Error('Tracker is enabled')) + killallServers([ server ]) reRunServer(server, { tracker: { enabled: false } }) .then(() => { @@ -83,10 +85,14 @@ describe('Test tracker', function () { torrent.on('error', done) torrent.on('warning', warn => { const message = typeof warn === 'string' ? warn : warn.message - if (message.includes('disabled ')) return done() + if (message.includes('disabled ')) { + torrent.off('done', errCb) + + return done() + } }) - torrent.on('done', () => done(new Error('Tracker is enabled'))) + torrent.on('done', errCb) }) }) -- cgit v1.2.3