MCPcopy
hub / github.com/feross/simple-peer / tryTest

Function tryTest

test/trickle.js:35–57  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

33 peer2.on('connect', tryTest)
34
35 function tryTest () {
36 if (!peer1.connected || !peer2.connected) return
37
38 t.equal(numSignal1, 1, 'only one `signal` event')
39 t.equal(numSignal2, 1, 'only one `signal` event')
40 t.equal(peer1.initiator, true, 'peer1 is initiator')
41 t.equal(peer2.initiator, false, 'peer2 is not initiator')
42
43 peer1.send('sup peer2')
44 peer2.on('data', function (data) {
45 t.equal(data.toString(), 'sup peer2', 'got correct message')
46
47 peer2.send('sup peer1')
48 peer1.on('data', function (data) {
49 t.equal(data.toString(), 'sup peer1', 'got correct message')
50
51 peer1.on('close', function () { t.pass('peer1 destroyed') })
52 peer1.destroy()
53 peer2.on('close', function () { t.pass('peer2 destroyed') })
54 peer2.destroy()
55 })
56 })
57 }
58})
59
60test('disable trickle (only initiator)', function (t) {

Callers

nothing calls this directly

Calls 2

sendMethod · 0.45
destroyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…