@@ -754,6 +754,49 @@ describe('ParseLiveQueryServer', function () {
754754 parseLiveQueryServer . _onAfterSave ( message ) ;
755755 } ) ;
756756
757+ it ( 'sends correct object for dates' , async ( ) => {
758+ jasmine . restoreLibrary ( '../lib/LiveQuery/QueryTools' , 'matchesQuery' ) ;
759+
760+ const parseLiveQueryServer = new ParseLiveQueryServer ( { } ) ;
761+
762+ const date = new Date ( ) ;
763+ const message = {
764+ currentParseObject : {
765+ date : { __type : 'Date' , iso : date . toISOString ( ) } ,
766+ __type : 'Object' ,
767+ key : 'value' ,
768+ className : testClassName ,
769+ } ,
770+ } ;
771+ // Add mock client
772+ const clientId = 1 ;
773+ const client = addMockClient ( parseLiveQueryServer , clientId ) ;
774+
775+ const requestId2 = 2 ;
776+
777+ await addMockSubscription ( parseLiveQueryServer , clientId , requestId2 ) ;
778+
779+ parseLiveQueryServer . _matchesACL = function ( ) {
780+ return Promise . resolve ( true ) ;
781+ } ;
782+
783+ parseLiveQueryServer . _inflateParseObject ( message ) ;
784+ parseLiveQueryServer . _onAfterSave ( message ) ;
785+
786+ // Make sure we send leave and enter command to client
787+ await timeout ( ) ;
788+
789+ expect ( client . pushCreate ) . toHaveBeenCalledWith (
790+ requestId2 ,
791+ {
792+ className : 'TestObject' ,
793+ key : 'value' ,
794+ date : { __type : 'Date' , iso : date . toISOString ( ) } ,
795+ } ,
796+ null
797+ ) ;
798+ } ) ;
799+
757800 it ( 'can handle object save command which does not match any subscription' , async done => {
758801 const parseLiveQueryServer = new ParseLiveQueryServer ( { } ) ;
759802 // Make mock request message
@@ -1138,8 +1181,7 @@ describe('ParseLiveQueryServer', function () {
11381181 expect ( toSend . original ) . toBeUndefined ( ) ;
11391182 expect ( spy ) . toHaveBeenCalledWith ( {
11401183 usage : 'Subscribing using fields parameter' ,
1141- solution :
1142- `Subscribe using "keys" instead.` ,
1184+ solution : `Subscribe using "keys" instead.` ,
11431185 } ) ;
11441186 } ) ;
11451187
@@ -1945,6 +1987,7 @@ describe('ParseLiveQueryServer', function () {
19451987 } else {
19461988 subscription . clientRequestIds = new Map ( [ [ clientId , [ requestId ] ] ] ) ;
19471989 }
1990+ subscription . query = query . where ;
19481991 return subscription ;
19491992 }
19501993
0 commit comments