Skip to content

Commit 5b9cb5c

Browse files
committed
Update vulnerabilities.spec.js
1 parent 87f9ac4 commit 5b9cb5c

1 file changed

Lines changed: 15 additions & 11 deletions

File tree

spec/vulnerabilities.spec.js

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)