@@ -956,7 +956,7 @@ describe('ParseLiveQuery', function () {
956956 await expectAsync ( query . subscribe ( ) ) . toBeRejectedWith ( new Error ( 'Invalid session token' ) ) ;
957957 } ) ;
958958
959- it_id ( '4ccc9508-ae6a-46ec-932a-9f5e49ab3b9e' ) ( it ) ( 'handle invalid websocket payload length' , async done => {
959+ it_id ( '4ccc9508-ae6a-46ec-932a-9f5e49ab3b9e' ) ( it ) ( 'handle invalid websocket payload length' , async ( ) => {
960960 await reconfigureServer ( {
961961 liveQuery : {
962962 classNames : [ 'TestObject' ] ,
@@ -982,15 +982,18 @@ describe('ParseLiveQuery', function () {
982982 const client = await Parse . CoreManager . getLiveQueryController ( ) . getDefaultLiveQueryClient ( ) ;
983983 client . socket . _socket . write ( Buffer . from ( [ 0x89 , 0xfe ] ) ) ;
984984
985- subscription . on ( 'update' , async object => {
986- expect ( object . get ( 'foo' ) ) . toBe ( 'bar' ) ;
987- done ( ) ;
985+ const updatePromise = new Promise ( resolve => {
986+ subscription . on ( 'update' , updatedObject => {
987+ expect ( updatedObject . get ( 'foo' ) ) . toBe ( 'bar' ) ;
988+ resolve ( ) ;
989+ } ) ;
988990 } ) ;
989991 // Wait for Websocket timeout to reconnect
990- setTimeout ( async ( ) => {
991- object . set ( { foo : 'bar' } ) ;
992- await object . save ( ) ;
993- } , 1000 ) ;
992+ await new Promise ( resolve => setTimeout ( resolve , 1000 ) ) ;
993+ object . set ( { foo : 'bar' } ) ;
994+ await object . save ( ) ;
995+
996+ await updatePromise ;
994997 } ) ;
995998
996999 it_id ( '39a9191f-26dd-4e05-a379-297a67928de8' ) ( it ) ( 'should execute live query update on email validation' , async done => {
0 commit comments