Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add tests to check fields used in whereIn should not be in implicit orderby #1081

Merged
merged 2 commits into from May 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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