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

WIP - add some tests of index scanning. #171

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"version": "1.0.0",
"repository": "github:rocicorp/replicache-sdk-js",
"scripts": {
"test": "web-test-runner src/replicache.test.ts --playwright --browsers chromium firefox",
"test:watch": "web-test-runner src/replicache.test.ts --playwright --browsers chromium firefox webkit --watch",
"test": "web-test-runner src/replicache.test.ts --playwright --browsers chromium firefox --root-dir=/",
"test:watch": "web-test-runner src/replicache.test.ts --playwright --browsers chromium firefox webkit --watch --root-dir=/",
"format": "prettier --write '{src,sample,perf}/**/*.{js,jsx,json,ts,tsx,html,css,md,mjs}' '*.{js,jsx,json,ts,tsx,html,css,md,mjs}'",
"check-format": "prettier --check '{src,sample,perf}/**/*.{js,jsx,json,ts,tsx,html,css,md,mjs}' '*.{js,jsx,json,ts,tsx,html,css,md,mjs}'",
"lint": "eslint --ext .ts src/",
Expand Down
3 changes: 3 additions & 0 deletions src/replicache.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,9 @@ test('index', async () => {

// TODO(arv): Also check the keys in all the calls to scanAll.
expect(await rep.scanAll({indexName: 'aIndex'})).to.have.lengthOf(5);
expect(await rep.scanAll({indexName: 'aIndex', prefix: '2'})).to.have.lengthOf(1);
expect(await rep.scanAll({indexName: 'aIndex', start: {key: {value: '2'}}})).to.have.lengthOf(3);
expect(await rep.scanAll({indexName: 'aIndex', start: {key: {value: '2', exclusive: true}}})).to.have.lengthOf(2);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@phritz this test fails unexpectedly (above succeeds). Is exclusive implemented for index scans yet?


await rep.register('drop-index', tx => tx.dropIndex('aIndex'))(null);
await expectPromiseToReject(rep.scanAll({indexName: 'aIndex'}));
Expand Down