@@ -754,6 +754,49 @@ describe('ParseLiveQueryServer', function () {
754
754
parseLiveQueryServer . _onAfterSave ( message ) ;
755
755
} ) ;
756
756
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
+
757
800
it ( 'can handle object save command which does not match any subscription' , async done => {
758
801
const parseLiveQueryServer = new ParseLiveQueryServer ( { } ) ;
759
802
// Make mock request message
@@ -1138,8 +1181,7 @@ describe('ParseLiveQueryServer', function () {
1138
1181
expect ( toSend . original ) . toBeUndefined ( ) ;
1139
1182
expect ( spy ) . toHaveBeenCalledWith ( {
1140
1183
usage : 'Subscribing using fields parameter' ,
1141
- solution :
1142
- `Subscribe using "keys" instead.` ,
1184
+ solution : `Subscribe using "keys" instead.` ,
1143
1185
} ) ;
1144
1186
} ) ;
1145
1187
@@ -1945,6 +1987,7 @@ describe('ParseLiveQueryServer', function () {
1945
1987
} else {
1946
1988
subscription . clientRequestIds = new Map ( [ [ clientId , [ requestId ] ] ] ) ;
1947
1989
}
1990
+ subscription . query = query . where ;
1948
1991
return subscription ;
1949
1992
}
1950
1993
0 commit comments