@@ -264,6 +264,45 @@ describe('LiveQueryClient', () => {
264264 expect ( isChecked ) . toBe ( true ) ;
265265 } ) ;
266266
267+ it ( 'can handle WebSocket response unset field' , async ( ) => {
268+ const liveQueryClient = new LiveQueryClient ( {
269+ applicationId : 'applicationId' ,
270+ serverURL : 'ws://test' ,
271+ javascriptKey : 'javascriptKey' ,
272+ masterKey : 'masterKey' ,
273+ sessionToken : 'sessionToken'
274+ } ) ;
275+ // Add mock subscription
276+ const subscription = new events . EventEmitter ( ) ;
277+ liveQueryClient . subscriptions . set ( 1 , subscription ) ;
278+
279+ const object = new ParseObject ( 'Test' ) ;
280+ const original = new ParseObject ( 'Test' ) ;
281+ const pointer = new ParseObject ( 'PointerTest' ) ;
282+ pointer . id = '1234' ;
283+ original . set ( 'pointer' , pointer ) ;
284+ const data = {
285+ op : 'update' ,
286+ clientId : 1 ,
287+ requestId : 1 ,
288+ object : object . _toFullJSON ( ) ,
289+ original : original . _toFullJSON ( ) ,
290+ } ;
291+ const event = {
292+ data : JSON . stringify ( data )
293+ }
294+ let isChecked = false ;
295+ subscription . on ( 'update' , ( parseObject , parseOriginalObject ) => {
296+ isChecked = true ;
297+ expect ( parseObject . toJSON ( ) . pointer ) . toBeUndefined ( ) ;
298+ expect ( parseOriginalObject . toJSON ( ) . pointer . objectId ) . toEqual ( pointer . id ) ;
299+ } ) ;
300+
301+ liveQueryClient . _handleWebSocketMessage ( event ) ;
302+
303+ expect ( isChecked ) . toBe ( true ) ;
304+ } ) ;
305+
267306 it ( 'can handle WebSocket close message' , ( ) => {
268307 const liveQueryClient = new LiveQueryClient ( {
269308 applicationId : 'applicationId' ,
0 commit comments