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

Function tryTest

test/object-mode.js:28–47  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26 peer2.on('connect', tryTest)
27
28 function tryTest () {
29 if (!peer1.connected || !peer2.connected) return
30
31 peer1.send('this is a string')
32 peer2.on('data', function (data) {
33 t.equal(typeof data, 'string', 'data is a string')
34 t.equal(data, 'this is a string', 'got correct message')
35
36 peer2.send('this is another string')
37 peer1.on('data', function (data) {
38 t.equal(typeof data, 'string', 'data is a string')
39 t.equal(data, 'this is another string', 'got correct message')
40
41 peer1.on('close', function () { t.pass('peer1 destroyed') })
42 peer1.destroy()
43 peer2.on('close', function () { t.pass('peer2 destroyed') })
44 peer2.destroy()
45 })
46 })
47 }
48})
49
50test('data send/receive Buffer {objectMode: true}', 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…