mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2024-12-13 02:46:29 +00:00
fix tests
This commit is contained in:
parent
b5687c6a3b
commit
d3a7c94f36
@ -2,6 +2,5 @@ language: node_js
|
||||
sudo: false
|
||||
node_js:
|
||||
- "node"
|
||||
- "4"
|
||||
before_script:
|
||||
- export DISPLAY=:99.0; sh -e /etc/init.d/xvfb start
|
||||
|
@ -1,12 +1,12 @@
|
||||
var Client = require('../')
|
||||
var common = require('./common')
|
||||
var test = require('tape')
|
||||
// var wrtc = require('electron-webrtc')()
|
||||
var wrtc = require('electron-webrtc')()
|
||||
|
||||
// var wrtcReady = false
|
||||
// wrtc.electronDaemon.once('ready', function () {
|
||||
// wrtcReady = true
|
||||
// })
|
||||
var wrtcReady = false
|
||||
wrtc.electronDaemon.once('ready', function () {
|
||||
wrtcReady = true
|
||||
})
|
||||
|
||||
var infoHash = '4cb67059ed6bd08362da625b3ae77f6f4a075705'
|
||||
var peerId = new Buffer('01234567890123456789')
|
||||
@ -31,7 +31,7 @@ function serverTest (t, serverType, serverFamily) {
|
||||
infoHash: infoHash,
|
||||
length: torrentLength,
|
||||
announce: [ announceUrl ]
|
||||
}/*, { wrtc: wrtc }*/)
|
||||
}, { wrtc: wrtc })
|
||||
|
||||
client1.start()
|
||||
|
||||
@ -87,7 +87,7 @@ function serverTest (t, serverType, serverFamily) {
|
||||
infoHash: infoHash,
|
||||
length: torrentLength,
|
||||
announce: [ announceUrl ]
|
||||
}/*, { wrtc: wrtc }*/)
|
||||
}, { wrtc: wrtc })
|
||||
|
||||
client2.start()
|
||||
|
||||
@ -111,9 +111,10 @@ function serverTest (t, serverType, serverFamily) {
|
||||
t.equal(data.complete, 0)
|
||||
t.equal(data.incomplete, 0)
|
||||
|
||||
client1.destroy()
|
||||
server.close()
|
||||
// if (serverType === 'ws') wrtc.close()
|
||||
client1.destroy(function () {
|
||||
server.close()
|
||||
if (serverType === 'ws') wrtc.close()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
@ -124,16 +125,16 @@ function serverTest (t, serverType, serverFamily) {
|
||||
})
|
||||
}
|
||||
|
||||
// test('websocket server', function (t) {
|
||||
// if (wrtcReady) {
|
||||
// runTest()
|
||||
// } else {
|
||||
// wrtc.electronDaemon.once('ready', runTest)
|
||||
// }
|
||||
// function runTest () {
|
||||
// serverTest(t, 'ws', 'inet')
|
||||
// }
|
||||
// })
|
||||
test('websocket server', function (t) {
|
||||
if (wrtcReady) {
|
||||
runTest()
|
||||
} else {
|
||||
wrtc.electronDaemon.once('ready', runTest)
|
||||
}
|
||||
function runTest () {
|
||||
serverTest(t, 'ws', 'inet')
|
||||
}
|
||||
})
|
||||
|
||||
test('http ipv4 server', function (t) {
|
||||
serverTest(t, 'http', 'inet')
|
||||
|
Loading…
Reference in New Issue
Block a user