Skip to content

Commit

Permalink
fix(adapter-tests): Add test that verified paginated total (#2273)
Browse files Browse the repository at this point in the history
  • Loading branch information
daffl committed Mar 29, 2021
1 parent 9f2a57c commit 879bd6b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/adapter-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"scripts": {
"prepublish": "npm run compile",
"compile": "shx rm -rf lib/ && tsc",
"test": "mocha --config ../../.mocharc.json --recursive test/**.test.ts test/**/*.test.ts"
"mocha": "mocha --config ../../.mocharc.json --recursive test/**.test.ts test/**/*.test.ts",
"test": "npm run compile && npm run mocha"
},
"directories": {
"lib": "lib"
Expand Down
14 changes: 14 additions & 0 deletions packages/adapter-tests/src/syntax.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,20 @@ export default (test: any, app: any, _errors: any, serviceName: string, idProp:
assert.strictEqual(page.data[0].name, 'Doug');
});

test('.find + paginate + query', async () => {
const page = await service.find({
query: {
$sort: { name: -1 },
name: 'Doug'
}
});

assert.strictEqual(page.total, 1);
assert.strictEqual(page.limit, 1);
assert.strictEqual(page.skip, 0);
assert.strictEqual(page.data[0].name, 'Doug');
});

test('.find + paginate + $limit + $skip', async () => {
const params = {
query: {
Expand Down

0 comments on commit 879bd6b

Please sign in to comment.