Skip to content

MIEQ: add negative test cases #7680

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

Merged
merged 27 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
0cd97c8
add inequality query negative tests
milaGGL Oct 5, 2023
ace5249
fix typo
milaGGL Oct 5, 2023
d62397b
Update gulpfile.js
milaGGL Oct 5, 2023
160d4ea
include new test helper in gulpfile.js
milaGGL Oct 5, 2023
e777b3c
remove src dependency
milaGGL Oct 5, 2023
e27915a
Update API reports
milaGGL Oct 5, 2023
97d22c2
add detailed instruction
milaGGL Oct 5, 2023
742482d
Update API reports
milaGGL Oct 5, 2023
63a6453
Update firestore.api.md
milaGGL Oct 6, 2023
aecdfb1
Update firestore.api.md
milaGGL Oct 6, 2023
a1145c2
Update API reports
milaGGL Oct 6, 2023
d62b1c0
Update API reports
milaGGL Oct 6, 2023
93eef1f
make AutoId internal, update testing instruction
milaGGL Oct 6, 2023
d9e0394
format
milaGGL Oct 6, 2023
f81cff0
Merge branch 'mila/fix-composite-index-testing-import-bug' into mila/…
milaGGL Oct 6, 2023
a6054a8
Update firestore.api.md
milaGGL Oct 6, 2023
1fa8477
Update gulpfile.js
milaGGL Oct 6, 2023
e07ece0
Update gulpfile.js
milaGGL Oct 6, 2023
6810d6b
remove dependency on ./helpers
milaGGL Oct 6, 2023
48ade93
fromat
milaGGL Oct 6, 2023
102806c
Merge branch 'mila/fix-composite-index-testing-import-bug' into mila/…
milaGGL Oct 6, 2023
6ae8b40
remove unnessecary export
milaGGL Oct 6, 2023
e9845cf
Update query.test.ts
milaGGL Oct 10, 2023
7c81348
Update query.test.ts
milaGGL Oct 10, 2023
7468d05
revert test to original version
milaGGL Oct 12, 2023
28afff2
update cloud-firestore-emulator version
milaGGL Oct 12, 2023
149e78d
Merge branch 'master' into mila/MIEQ-negative-test-cases
milaGGL Oct 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions packages/firestore/test/integration/api/query.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1912,6 +1912,34 @@ apiDescribe('Queries', persistence => {
});
}
);

it('inequality query will reject if document key is not the last orderBy field', () => {
return withEmptyTestCollection(persistence, async coll => {
// Implicitly ordered by: __name__ asc, 'key' asc,
const queryForRejection = query(
coll,
where('key', '!=', 42),
orderBy(documentId())
);

await expect(getDocs(queryForRejection)).to.be.eventually.rejectedWith(
'order by clause cannot contain more fields after the key'
);
});
});

it('inequality query will reject if document key appears only in equality filter', () => {
return withEmptyTestCollection(persistence, async coll => {
const query_ = query(
coll,
where('key', '!=', 42),
where(documentId(), '==', 'doc1')
);
await expect(getDocs(query_)).to.be.eventually.rejectedWith(
'Equality on key is not allowed if there are other inequality fields and key does not appear in inequalities.'
);
});
});
});

// OR Query tests only run when the SDK's local cache is configured to use
Expand Down
2 changes: 1 addition & 1 deletion scripts/emulator-testing/emulators/firestore-emulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class FirestoreEmulator extends Emulator {
// Use locked version of emulator for test to be deterministic.
// The latest version can be found from firestore emulator doc:
// https://firebase.google.com/docs/firestore/security/test-rules-emulator
'https://storage.googleapis.com/firebase-preview-drop/emulator/cloud-firestore-emulator-v1.18.1.jar',
'https://storage.googleapis.com/firebase-preview-drop/emulator/cloud-firestore-emulator-v1.18.2.jar',
port
);
this.projectId = projectId;
Expand Down