diff options
-rw-r--r-- | server/tests/api/server/tracker.ts | 10 |
1 files changed, 8 insertions, 2 deletions
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 () { | |||
73 | it('Should disable the tracker', function (done) { | 73 | it('Should disable the tracker', function (done) { |
74 | this.timeout(20000) | 74 | this.timeout(20000) |
75 | 75 | ||
76 | const errCb = () => done(new Error('Tracker is enabled')) | ||
77 | |||
76 | killallServers([ server ]) | 78 | killallServers([ server ]) |
77 | reRunServer(server, { tracker: { enabled: false } }) | 79 | reRunServer(server, { tracker: { enabled: false } }) |
78 | .then(() => { | 80 | .then(() => { |
@@ -83,10 +85,14 @@ describe('Test tracker', function () { | |||
83 | torrent.on('error', done) | 85 | torrent.on('error', done) |
84 | torrent.on('warning', warn => { | 86 | torrent.on('warning', warn => { |
85 | const message = typeof warn === 'string' ? warn : warn.message | 87 | const message = typeof warn === 'string' ? warn : warn.message |
86 | if (message.includes('disabled ')) return done() | 88 | if (message.includes('disabled ')) { |
89 | torrent.off('done', errCb) | ||
90 | |||
91 | return done() | ||
92 | } | ||
87 | }) | 93 | }) |
88 | 94 | ||
89 | torrent.on('done', () => done(new Error('Tracker is enabled'))) | 95 | torrent.on('done', errCb) |
90 | }) | 96 | }) |
91 | }) | 97 | }) |
92 | 98 | ||