fix: liveQuery with containedIn not working when object field is an array (#8128)

This commit is contained in:
Stew
2022-09-17 08:59:45 -03:00
committed by GitHub
parent 4a45cc467c
commit 1d9605bc93
2 changed files with 33 additions and 0 deletions

View File

@@ -583,6 +583,29 @@ describe('matchesQuery', function () {
expect(matchesQuery(message, q)).toBe(false);
});
it('should support containedIn with array of pointers', () => {
const message = {
id: new Id('Message', 'O2'),
profiles: [pointer('Profile', 'yeahaw'), pointer('Profile', 'yes')],
};
let q = new Parse.Query('Message');
q.containedIn('profiles', [
Parse.Object.fromJSON({ className: 'Profile', objectId: 'no' }),
Parse.Object.fromJSON({ className: 'Profile', objectId: 'yes' }),
]);
expect(matchesQuery(message, q)).toBe(true);
q = new Parse.Query('Message');
q.containedIn('profiles', [
Parse.Object.fromJSON({ className: 'Profile', objectId: 'no' }),
Parse.Object.fromJSON({ className: 'Profile', objectId: 'nope' }),
]);
expect(matchesQuery(message, q)).toBe(false);
});
it('should support notContainedIn with pointers', () => {
let message = {
id: new Id('Message', 'O1'),