diff options
author | Feross Aboukhadijeh <feross@feross.org> | 2015-01-26 22:18:47 +0300 |
---|---|---|
committer | Feross Aboukhadijeh <feross@feross.org> | 2015-01-26 22:18:47 +0300 |
commit | df77c9474303167485525946a62163d009efc6f8 (patch) | |
tree | 52f46eca6fc1935365e1f66ac4714bc64c5b5cc6 /test/basic.js | |
parent | 2570b37e1f7b90ae89530c4b4fb58d90b048aa7a (diff) |
after client.destroy(), no "torrent" event should be emitted
Fixes #254
Diffstat (limited to 'test/basic.js')
-rw-r--r-- | test/basic.js | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/test/basic.js b/test/basic.js index 1e3db44..241594e 100644 --- a/test/basic.js +++ b/test/basic.js @@ -84,15 +84,32 @@ test('client.seed (Buffer, Blob)', function (t) { } }) -test('throw if add or seed after destroy', function (t) { +test('after client.destroy(), throw on client.add() or client.seed()', function (t) { + t.plan(3) + var client = new WebTorrent({ dht: false, tracker: false }) - client.destroy() + client.destroy(function () { + t.pass('client destroyed') + }) t.throws(function () { client.add('magnet:?xt=urn:btih:' + leavesTorrent.infoHash) }) t.throws(function () { client.seed(new Buffer('sup')) }) - t.end() }) +test('after client.destroy(), no "torrent" event should be emitted', function (t) { + t.plan(1) + + var client = new WebTorrent({ dht: false, tracker: false }) + client.add(leaves, function () { + t.fail('unexpected "torrent" event') + }) + client.seed(leavesBook, function () { + t.fail('unexpected "torrent" event') + }) + client.destroy(function () { + t.pass('client destroyed') + }) +}) |