Try to fix tracker tests issues
This commit is contained in:
parent
677119c914
commit
cf5d7d9d94
|
@ -73,6 +73,8 @@ describe('Test tracker', function () {
|
||||||
it('Should disable the tracker', function (done) {
|
it('Should disable the tracker', function (done) {
|
||||||
this.timeout(20000)
|
this.timeout(20000)
|
||||||
|
|
||||||
|
const errCb = () => done(new Error('Tracker is enabled'))
|
||||||
|
|
||||||
killallServers([ server ])
|
killallServers([ server ])
|
||||||
reRunServer(server, { tracker: { enabled: false } })
|
reRunServer(server, { tracker: { enabled: false } })
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
@ -83,10 +85,14 @@ describe('Test tracker', function () {
|
||||||
torrent.on('error', done)
|
torrent.on('error', done)
|
||||||
torrent.on('warning', warn => {
|
torrent.on('warning', warn => {
|
||||||
const message = typeof warn === 'string' ? warn : warn.message
|
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)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue