@@ -2816,7 +2816,7 @@ describe('(GHSA-fjxm-vhvc-gcmj) LiveQuery Operator Type Confusion', () => {
28162816
28172817 // Integration test: verify that a LiveQuery subscription with type-confused
28182818 // operators does not crash the server and other subscriptions continue working
2819- it ( 'server does not crash and other subscriptions work when type-confused subscription exists' , async done => {
2819+ it ( 'server does not crash and other subscriptions work when type-confused subscription exists' , async ( ) => {
28202820 // First subscribe with a malformed query via manual client
28212821 const malClient = new Parse . LiveQueryClient ( {
28222822 applicationId : 'test' ,
@@ -2833,16 +2833,20 @@ describe('(GHSA-fjxm-vhvc-gcmj) LiveQuery Operator Type Confusion', () => {
28332833 validQuery . equalTo ( 'name' , 'test' ) ;
28342834 const validSubscription = await validQuery . subscribe ( ) ;
28352835
2836- validSubscription . on ( 'create' , object => {
2837- // The valid subscription should still receive events
2838- expect ( object . get ( 'name' ) ) . toBe ( 'test' ) ;
2839- malClient . close ( ) ;
2840- done ( ) ;
2841- } ) ;
2836+ try {
2837+ const createPromise = new Promise ( resolve => {
2838+ validSubscription . on ( 'create' , object => {
2839+ expect ( object . get ( 'name' ) ) . toBe ( 'test' ) ;
2840+ resolve ( ) ;
2841+ } ) ;
2842+ } ) ;
28422843
2843- // Trigger an event
2844- const obj = new Parse . Object ( 'TestObject' ) ;
2845- obj . set ( 'name' , 'test' ) ;
2846- await obj . save ( ) ;
2844+ const obj = new Parse . Object ( 'TestObject' ) ;
2845+ obj . set ( 'name' , 'test' ) ;
2846+ await obj . save ( ) ;
2847+ await createPromise ;
2848+ } finally {
2849+ malClient . close ( ) ;
2850+ }
28472851 } ) ;
28482852} ) ;
0 commit comments