mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
fix(test): mock wire event in webtorrent regression test
Simulates a 'wire' event in MockWebTorrent when a webseed is present, ensuring probePeers correctly identifies the stream as healthy. Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
a3cc4a7456
commit
a7c752a6af
1 file changed
+5
@@ -19,6 +19,11 @@ class MockWebTorrent extends EventEmitter {
|
||||
setTimeout(() => {
|
||||
if (typeof cb === 'function') cb(torrent);
|
||||
this.emit('torrent', torrent);
|
||||
|
||||
// Simulate webseed connection if urlList is present
|
||||
if (opts && Array.isArray(opts.urlList) && opts.urlList.length > 0) {
|
||||
torrent.emit('wire', { type: 'webSeed' });
|
||||
}
|
||||
}, 10);
|
||||
|
||||
return torrent;
|
||||
|
||||
Reference in new issue
Block a user