diff options
author | Feross Aboukhadijeh <feross@feross.org> | 2015-08-24 01:25:38 +0300 |
---|---|---|
committer | Feross Aboukhadijeh <feross@feross.org> | 2015-08-24 01:25:38 +0300 |
commit | 931a10c0fdb86ad926d586558db5102b13c7065d (patch) | |
tree | 1875f375e1c6fd401bf41fa2d940acb3676df63f /test/download-webseed-magnet.js | |
parent | 1fc60bb9d5fc3d73b6035b8ef48cdea64bba4289 (diff) |
improve tests to pass when verifying torrent data
Diffstat (limited to 'test/download-webseed-magnet.js')
-rw-r--r-- | test/download-webseed-magnet.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/test/download-webseed-magnet.js b/test/download-webseed-magnet.js index 214a92b..97ec256 100644 --- a/test/download-webseed-magnet.js +++ b/test/download-webseed-magnet.js @@ -81,13 +81,22 @@ test('Download using webseed (via magnet uri)', function (t) { file.getBuffer(function (err, buf) { t.error(err) t.deepEqual(buf, leavesFile, 'downloaded correct content') + gotBuffer = true + maybeDone() }) }) torrent.once('done', function () { t.pass('client2 downloaded torrent from client1') - cb(null, client2) + torrentDone = true + maybeDone() }) + + var gotBuffer = false + var torrentDone = false + function maybeDone () { + if (gotBuffer && torrentDone) cb(null, client2) + } }) client2.add(magnetUri) |