Skip to content

Commit

Permalink
fix: Add tests to check fields used in whereIn should be equality fil…
Browse files Browse the repository at this point in the history
…ters (#1081)
  • Loading branch information
wu-hui committed May 14, 2020
1 parent 40f14d2 commit 3153dd2
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions dev/test/query.ts
Expand Up @@ -909,6 +909,41 @@ describe('where() interface', () => {
});
});

it('Fields of IN queries are not used in implicit order by', async () => {
const overrides: ApiOverride = {
runQuery: request => {
queryEquals(
request,
fieldFilters('foo', 'IN', {
arrayValue: {
values: [
{
stringValue: `bar`,
},
],
},
}),
orderBy('__name__', 'ASCENDING'),
startAt(true, {
referenceValue:
`projects/${PROJECT_ID}/databases/(default)/` +
'documents/collectionId/doc1',
})
);

return stream();
},
};

return createInstance(overrides).then(async firestore => {
const collection = firestore.collection('collectionId');
const query = collection
.where('foo', 'in', ['bar'])
.startAt(await snapshot('collectionId/doc1', {}));
return query.get();
});
});

it('validates references for IN queries', () => {
const query = firestore.collection('collectionId');

Expand Down

0 comments on commit 3153dd2

Please sign in to comment.