From: Chocobozzz Date: Fri, 20 Mar 2020 15:17:14 +0000 (+0100) Subject: Try to fix tracker tests issues X-Git-Tag: v2.2.0-rc.1~330 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=cf5d7d9d942a13b0a55427367740885defc26469;p=oweals%2Fpeertube.git Try to fix tracker tests issues --- 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) }) })