Skip to content

Commit

Permalink
Update filter tests for passwords (#5698)
Browse files Browse the repository at this point in the history
  • Loading branch information
timleslie authored May 13, 2021
1 parent 71215bb commit 4ea26bc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
17 changes: 8 additions & 9 deletions packages-next/fields/src/types/password/tests/test-fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export const exampleValue = () => 'password';
export const exampleValue2 = () => 'password2';
export const supportsUnique = false;
export const fieldName = 'password';
export const readFieldName = 'password';
export const subfieldName = 'isSet';
export const skipCreateTest = true;
export const skipUpdateTest = true;
Expand All @@ -27,13 +26,13 @@ export const initItems = () => {
};

export const storedValues = () => [
{ name: 'person1', password_is_set: true },
{ name: 'person2', password_is_set: false },
{ name: 'person3', password_is_set: true },
{ name: 'person4', password_is_set: true },
{ name: 'person5', password_is_set: true },
{ name: 'person6', password_is_set: false },
{ name: 'person7', password_is_set: false },
{ name: 'person1', password: { isSet: true } },
{ name: 'person2', password: { isSet: false } },
{ name: 'person3', password: { isSet: true } },
{ name: 'person4', password: { isSet: true } },
{ name: 'person5', password: { isSet: true } },
{ name: 'person6', password: { isSet: false } },
{ name: 'person7', password: { isSet: false } },
];

export const supportedFilters = () => ['is_set'];
export const supportedFilters = () => ['isSet'];
6 changes: 3 additions & 3 deletions tests/api-tests/fields/filter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,18 +342,18 @@ multiAdapterRunners().map(({ runner, provider }) =>
)
);
}
if (mod.supportedFilters(provider).includes('is_set')) {
if (mod.supportedFilters(provider).includes('isSet')) {
test(
'Is Set - true',
withKeystone(({ context }) =>
match(context, { [`${fieldName}_is_set`]: true }, [0, 2, 3, 4])
match(context, { [fieldName]: { isSet: true } }, [0, 2, 3, 4])
)
);

test(
'Is Set - false',
withKeystone(({ context }) =>
match(context, { [`${fieldName}_is_set`]: false }, [1, 5, 6])
match(context, { [fieldName]: { isSet: false } }, [1, 5, 6])
)
);
}
Expand Down

0 comments on commit 4ea26bc

Please sign in to comment.