This repository was archived by the owner on Mar 11, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change 36
36
"dependencies" : {
37
37
"chai" : " ^3.5.0" ,
38
38
"multiaddr" : " ^2.0.2" ,
39
+ "pull-goodbye" : " 0.0.1" ,
39
40
"pull-stream" : " ^3.4.4"
40
41
}
41
42
}
Original file line number Diff line number Diff line change 3
3
4
4
const expect = require ( 'chai' ) . expect
5
5
const pull = require ( 'pull-stream' )
6
+ const goodbye = require ( 'pull-goodbye' )
6
7
7
8
module . exports = ( common ) => {
8
9
describe ( 'dial' , ( ) => {
@@ -27,7 +28,12 @@ module.exports = (common) => {
27
28
listener = transport . createListener ( ( conn ) => {
28
29
pull (
29
30
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
+ } ) ,
31
37
conn
32
38
)
33
39
} )
@@ -39,10 +45,9 @@ module.exports = (common) => {
39
45
} )
40
46
41
47
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 ) => {
46
51
expect ( err ) . to . not . exist
47
52
expect (
48
53
values
@@ -51,7 +56,9 @@ module.exports = (common) => {
51
56
)
52
57
done ( )
53
58
} )
54
- )
59
+ } )
60
+
61
+ pull ( s , transport . dial ( addrs [ 0 ] ) , s )
55
62
} )
56
63
57
64
it ( 'to non existent listener' , ( done ) => {
You can’t perform that action at this time.
0 commit comments