@@ -48,6 +48,42 @@ test('get and put', function (t) {
4848 } )
4949} )
5050
51+ test ( 'get empty' , function ( t ) {
52+ t . plan ( 7 )
53+
54+ const a = build ( )
55+ t . tearDown ( a . close . bind ( a ) )
56+
57+ a . upring . on ( 'up' , function ( ) {
58+ t . pass ( 'a up' )
59+ const b = build ( a )
60+
61+ t . tearDown ( b . close . bind ( b ) )
62+
63+ b . upring . on ( 'up' , function ( ) {
64+ t . pass ( 'b up' )
65+
66+ b . get ( 'hello' , function ( err , res ) {
67+ t . error ( err )
68+ t . equal ( res , undefined )
69+
70+ const c = build ( a )
71+
72+ t . tearDown ( c . close . bind ( c ) )
73+
74+ c . upring . on ( 'up' , function ( ) {
75+ t . pass ( 'c up' )
76+
77+ c . get ( 'hello' , function ( err , res ) {
78+ t . error ( err )
79+ t . equal ( res , undefined )
80+ } )
81+ } )
82+ } )
83+ } )
84+ } )
85+ } )
86+
5187test ( 'moving data' , function ( t ) {
5288 t . plan ( 13 )
5389
@@ -161,11 +197,13 @@ test('liveUpdates', function (t) {
161197 b . put ( key , 'matteo' , function ( err ) {
162198 t . error ( err )
163199
164- b . close ( function ( ) {
165- t . pass ( 'closed' )
200+ stream . once ( 'data' , function ( ) {
201+ b . close ( function ( ) {
202+ t . pass ( 'closed' )
166203
167- a . put ( key , 'luca' , function ( err ) {
168- t . error ( err )
204+ a . put ( key , 'luca' , function ( err ) {
205+ t . error ( err )
206+ } )
169207 } )
170208 } )
171209 } )
@@ -174,39 +212,3 @@ test('liveUpdates', function (t) {
174212 } )
175213 } )
176214} )
177-
178- test ( 'get empty' , function ( t ) {
179- t . plan ( 7 )
180-
181- const a = build ( )
182- t . tearDown ( a . close . bind ( a ) )
183-
184- a . upring . on ( 'up' , function ( ) {
185- t . pass ( 'a up' )
186- const b = build ( a )
187-
188- t . tearDown ( b . close . bind ( b ) )
189-
190- b . upring . on ( 'up' , function ( ) {
191- t . pass ( 'b up' )
192-
193- b . get ( 'hello' , function ( err , res ) {
194- t . error ( err )
195- t . equal ( res , undefined )
196-
197- const c = build ( a )
198-
199- t . tearDown ( c . close . bind ( c ) )
200-
201- c . upring . on ( 'up' , function ( ) {
202- t . pass ( 'c up' )
203-
204- c . get ( 'hello' , function ( err , res ) {
205- t . error ( err )
206- t . equal ( res , undefined )
207- } )
208- } )
209- } )
210- } )
211- } )
212- } )
0 commit comments