Skip to content

Commit d35ce85

Browse files
committed
added more testcase for new query format
1 parent 24e5964 commit d35ce85

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

spec/QueryTools.spec.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,41 @@ describe('matchesQuery', function () {
270270
expect(matchesQuery(obj1, q)).toBe(true);
271271
});
272272

273+
it('matches on queries with new format #parse-SDK-JS/pull/1373 for Pointer', function () {
274+
const obj1 = {
275+
objectId: 'Person01',
276+
name: 'Bill',
277+
age: 34,
278+
};
279+
280+
const obj2 = {
281+
objectId: 'Car01',
282+
name: 'Volkswagen',
283+
owner: pointer('Person', obj1.objectId),
284+
};
285+
286+
const q = {
287+
owner: {
288+
$eq: pointer('Person', obj1.objectId),
289+
},
290+
};
291+
expect(matchesQuery(obj2, q)).toBe(true);
292+
});
293+
294+
it('matches on queries with new format #parse-SDK-JS/pull/1373 for Object', function () {
295+
const obj1 = {
296+
id: new Id('Person', '01'),
297+
addr: { planet: 'Earth' },
298+
};
299+
300+
const q = {
301+
addr: {
302+
$eq: { planet: 'Earth' },
303+
},
304+
};
305+
expect(matchesQuery(obj1, q)).toBe(true);
306+
});
307+
273308
it('matches on inequalities', function () {
274309
const player = {
275310
id: new Id('Person', 'O1'),

0 commit comments

Comments
 (0)