Skip to content
55 changes: 55 additions & 0 deletions spec/ParseLiveQuery.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1308,4 +1308,59 @@ describe('ParseLiveQuery', function () {
await new Promise(resolve => setTimeout(resolve, 100));
expect(createSpy).toHaveBeenCalledTimes(1);
});

fit('Live query should work if needle is ParsePointer and haystack is any[], checking QueryTools.js>contains', async () => {
await reconfigureServer({
liveQuery: {
classNames: ['TestObject'],
},
startLiveQueryServer: true,
verbose: false,
silent: true,
});

const child1 = new Parse.Object('Child');
await child1.save();
const child2 = new Parse.Object('Child');
await child2.save();
const child3 = new Parse.Object('Child');
await child3.save();

const query = new Parse.Query(TestObject);
query.containedIn('childs', [child1, child2, null]);

const subscription = await query.subscribe();
subscription.on('create', () => {});

// Do not need any expect block, just make sure that the server doesn't crash or throw error
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add expect, presumably await expectAsync(...).toBeResolved();?

const object1 = new TestObject();
object1.set('childs', [child3]);
await object1.save();
});


fit('Live query should work if we set equalTo(someKey,someParseObject) and new Parse object is created but someKey = null', async () => {
await reconfigureServer({
liveQuery: {
classNames: ['TestObject'],
},
startLiveQueryServer: true,
verbose: false,
silent: true,
});

const child = new Parse.Object('Child');
await child.save();

const query = new Parse.Query(TestObject);
query.equalTo('child', child);

const subscription = await query.subscribe();
subscription.on('create', () => {});

// Do not need any expect block, just make sure that the server doesn't crash or throw error
const object1 = new TestObject();
object1.set('child', null);
await object1.save();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add expect

});
});
Loading