Skip to content

Commit

Permalink
Fix #140 adding test for snapshot ready
Browse files Browse the repository at this point in the history
  • Loading branch information
yasserf committed Jul 27, 2016
1 parent d8c03fc commit 59843ac
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions test-e2e/specs/record-snapshotSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe( 'record snapshot', function() {

it( 'creates clientA', function( done ) {
clientA = deepstreamClient( 'localhost:6021' );
clientA.login( null, function(){ done(); });
clientA.login( null, done );
});

/**************** TEST ****************/
Expand Down Expand Up @@ -59,12 +59,23 @@ describe( 'record snapshot', function() {
clientA.record.snapshot( 'localRecord', function( error, data ) {
expect( error ).toBeNull();
expect( data ).toEqual( { key: 'value' } );
done();
record.on( 'discard', done );
record.discard();
} );
}, 10 );
} );
});

it( 'retrieves remote snapshot if client record is not ready', function( done ){
var record = clientA.record.getRecord( 'localRecord' );

clientA.record.snapshot( 'localRecord', function( error, data ) {
expect( error ).toBeNull();
expect( data ).toEqual( { key: 'value' } );
done();
} );
});

/**************** TEAR DOWN ****************/
it( 'closes the clients', function() {
clientA.close();
Expand Down

0 comments on commit 59843ac

Please sign in to comment.