Refactor Filter type to accept Is, Is Not, Contains, Does not Contain (#128)
* Refactor Filter type to accept Is, Is Not, Contains, Does not Contain * Remove any and add tests
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import { GraphqlQueryPerson } from '../../../../interfaces/person.interface';
|
||||
import { GraphqlQueryPerson } from '../../../../interfaces/entities/person.interface';
|
||||
|
||||
export const mockData: Array<GraphqlQueryPerson> = [
|
||||
export const mockPeopleData: Array<GraphqlQueryPerson> = [
|
||||
{
|
||||
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6b',
|
||||
__typename: 'Person',
|
||||
|
||||
@ -1,9 +1,19 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`PeopleFilter should render the filter city 1`] = `
|
||||
exports[`PeopleFilter should render the filter city which is text search 1`] = `
|
||||
Object {
|
||||
"city": Object {
|
||||
"_eq": "Paris",
|
||||
"_ilike": "%Paris%",
|
||||
},
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`PeopleFilter should render the filter company_name which relation search 1`] = `
|
||||
Object {
|
||||
"company": Object {
|
||||
"name": Object {
|
||||
"_eq": "test-name",
|
||||
},
|
||||
},
|
||||
}
|
||||
`;
|
||||
|
||||
@ -1,20 +1,18 @@
|
||||
import { cityFilter } from '../people-filters';
|
||||
import { cityFilter, companyFilter } from '../people-filters';
|
||||
|
||||
describe('PeopleFilter', () => {
|
||||
it(`should render the filter ${cityFilter.key}`, () => {
|
||||
it(`should render the filter ${companyFilter.key} which relation search`, () => {
|
||||
expect(
|
||||
cityFilter.operands[0].whereTemplate({
|
||||
companyFilter.operands[0].whereTemplate({
|
||||
id: 'test-id',
|
||||
city: 'Paris',
|
||||
email: 'john@doe.com',
|
||||
firstname: 'John',
|
||||
lastname: 'Doe',
|
||||
phone: '0123456789',
|
||||
creationDate: new Date(),
|
||||
pipes: [],
|
||||
company: null,
|
||||
__typename: 'people',
|
||||
name: 'test-name',
|
||||
domainName: 'test-domain-name',
|
||||
__typename: 'companies',
|
||||
}),
|
||||
).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it(`should render the filter ${cityFilter.key} which is text search`, () => {
|
||||
expect(cityFilter.operands[0].whereTemplate('Paris')).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user