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

Check for errors in matchFilter #3251

Merged
merged 1 commit into from Jul 14, 2020
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions .changeset/silent-onions-taste.md
@@ -0,0 +1,5 @@
---
'@keystonejs/test-utils': patch
---

Improved error reporting in `matchFilter`.
5 changes: 3 additions & 2 deletions packages/fields/tests/test-fixtures.js
Expand Up @@ -105,8 +105,9 @@ export const filterTests = withKeystone => {

test(
'Filter: id_in - missing id',
withKeystone(({ keystone }) => {
return match(keystone, 'where: { id_in: ["0123456789abcdef01234567"] }', []);
withKeystone(({ keystone, adapterName }) => {
const fakeID = adapterName === 'mongoose' ? '"0123456789abcdef01234567"' : 1000;
return match(keystone, `where: { id_in: [${fakeID}] }`, []);
})
);

Expand Down
3 changes: 2 additions & 1 deletion packages/test-utils/lib/test-utils.js
Expand Up @@ -251,7 +251,8 @@ const matchFilter = ({ keystone, queryArgs, fieldSelection, expected, sortKey })
query: `query {
allTests${queryArgs ? `(${queryArgs})` : ''} { ${fieldSelection} }
}`,
}).then(({ data }) => {
}).then(({ data, errors }) => {
expect(errors).toBe(undefined);
const value = sortKey ? sorted(data.allTests || [], i => i[sortKey]) : data.allTests;
expect(value).toEqual(expected);
});
Expand Down