@@ -50,7 +50,7 @@ const spawnGoDaemon = (callback) => {
50
50
51
51
const ipfsRef = '/ipfs/QmPFVLPmp9zv5Z5KUqLhe2EivAGccQW2r7M7jhVJGLZoZU'
52
52
53
- describe ( 'ipns-pubsub' , ( ) => {
53
+ describe . only ( 'ipns-pubsub' , ( ) => {
54
54
let nodeAId
55
55
let nodeBId
56
56
let nodes = [ ]
@@ -87,7 +87,10 @@ describe('ipns-pubsub', () => {
87
87
nodeAId = ids [ 0 ]
88
88
nodeBId = ids [ 1 ]
89
89
90
- nodes [ 0 ] . api . swarm . connect ( ids [ 1 ] . addresses [ 0 ] , ( ) => {
90
+ nodes [ 0 ] . api . swarm . connect ( ids [ 1 ] . addresses [ 0 ] , ( err ) => {
91
+ expect ( err ) . to . not . exist ( )
92
+
93
+ console . log ( 'wait for republish as we can receive the republish message first' )
91
94
setTimeout ( done , 60000 ) // wait for republish as we can receive the republish message first
92
95
} )
93
96
} )
@@ -130,21 +133,22 @@ const subscribeToReceiveByPubsub = (nodeA, nodeB, id, callback) => {
130
133
const keys = ipns . getIdKeys ( fromB58String ( id ) )
131
134
const topic = `${ namespace } ${ base64url . encode ( keys . routingKey . toBuffer ( ) ) } `
132
135
133
- nodeB . api . name . resolve ( id , ( ) => {
136
+ // try to resolve a unpublished record (will subscribe it)
137
+ nodeB . api . name . resolve ( id , ( err ) => {
138
+ expect ( err ) . to . exist ( ) // not found
139
+
134
140
series ( [
135
141
( cb ) => waitForPeerToSubscribe ( nodeB . api , topic , cb ) ,
136
142
( cb ) => nodeB . api . pubsub . subscribe ( topic , checkMessage , cb ) ,
137
143
( cb ) => nodeA . api . name . publish ( ipfsRef , { resolve : false } , cb ) ,
138
- ( cb ) => nodeA . api . name . resolve ( id , cb ) ,
139
144
( cb ) => waitFor ( ( ) => subscribed === true , ( 50 * 1000 ) , cb ) ,
140
145
( cb ) => nodeB . api . name . resolve ( id , cb )
141
146
] , ( err , res ) => {
142
147
expect ( err ) . to . not . exist ( )
143
148
expect ( res ) . to . exist ( )
144
149
145
150
expect ( res [ 2 ] . name ) . to . equal ( id ) // Published to Node A ID
146
- expect ( res [ 3 ] ) . to . equal ( ipfsRef ) // TODO: remove path once not using proc daemon
147
- expect ( res [ 5 ] ) . to . equal ( ipfsRef )
151
+ expect ( res [ 4 ] ) . to . equal ( ipfsRef )
148
152
149
153
callback ( )
150
154
} )
0 commit comments