Skip to content
This repository was archived by the owner on Mar 11, 2020. It is now read-only.

Commit 99abe2c

Browse files
make websocket compatible
1 parent aff8834 commit 99abe2c

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"dependencies": {
3737
"chai": "^3.5.0",
3838
"multiaddr": "^2.0.2",
39+
"pull-goodbye": "0.0.1",
3940
"pull-stream": "^3.4.4"
4041
}
4142
}

src/dial-test.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
const expect = require('chai').expect
55
const pull = require('pull-stream')
6+
const goodbye = require('pull-goodbye')
67

78
module.exports = (common) => {
89
describe('dial', () => {
@@ -27,7 +28,12 @@ module.exports = (common) => {
2728
listener = transport.createListener((conn) => {
2829
pull(
2930
conn,
30-
pull.map((x) => new Buffer(x.toString() + '!')),
31+
pull.map((x) => {
32+
if (x.toString() !== 'GOODBYE') {
33+
return new Buffer(x.toString() + '!')
34+
}
35+
return x
36+
}),
3137
conn
3238
)
3339
})
@@ -39,10 +45,9 @@ module.exports = (common) => {
3945
})
4046

4147
it('simple', (done) => {
42-
pull(
43-
pull.values(['hey']),
44-
transport.dial(addrs[0]),
45-
pull.collect((err, values) => {
48+
const s = goodbye({
49+
source: pull.values([new Buffer('hey')]),
50+
sink: pull.collect((err, values) => {
4651
expect(err).to.not.exist
4752
expect(
4853
values
@@ -51,7 +56,9 @@ module.exports = (common) => {
5156
)
5257
done()
5358
})
54-
)
59+
})
60+
61+
pull(s, transport.dial(addrs[0]), s)
5562
})
5663

5764
it('to non existent listener', (done) => {

0 commit comments

Comments
 (0)