Sammy/t 195 aau i see filters and sort on company (#104)
* feature: add company filter by name * feature: add fitler on URL * feature: set icons for sorts * feature: add creation date and address sorts * Add tests --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
73
front/src/pages/people/__tests__/__data__/mock-data.ts
Normal file
73
front/src/pages/people/__tests__/__data__/mock-data.ts
Normal file
@ -0,0 +1,73 @@
|
||||
import { GraphqlQueryPerson } from '../../../../interfaces/person.interface';
|
||||
|
||||
export const mockData: Array<GraphqlQueryPerson> = [
|
||||
{
|
||||
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6b',
|
||||
__typename: 'Person',
|
||||
firstname: 'Alexandre',
|
||||
lastname: 'Prot',
|
||||
email: 'alexandre@qonto.com',
|
||||
company: {
|
||||
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6c',
|
||||
name: 'Qonto',
|
||||
domain_name: 'qonto.com',
|
||||
__typename: 'Company',
|
||||
},
|
||||
phone: '06 12 34 56 78',
|
||||
created_at: '2023-04-20T13:20:09.158312+00:00',
|
||||
|
||||
city: 'Paris',
|
||||
},
|
||||
{
|
||||
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6d',
|
||||
__typename: 'Person',
|
||||
firstname: 'John',
|
||||
lastname: 'Doe',
|
||||
email: 'john@linkedin.com',
|
||||
company: {
|
||||
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6e',
|
||||
name: 'LinkedIn',
|
||||
domain_name: 'linkedin.com',
|
||||
__typename: 'Company',
|
||||
},
|
||||
phone: '06 12 34 56 78',
|
||||
created_at: '2023-04-20T13:20:09.158312+00:00',
|
||||
|
||||
city: 'Paris',
|
||||
},
|
||||
{
|
||||
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6f',
|
||||
__typename: 'Person',
|
||||
firstname: 'Jane',
|
||||
lastname: 'Doe',
|
||||
email: 'jane@sequoiacap.com',
|
||||
company: {
|
||||
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6g',
|
||||
name: 'Sequoia',
|
||||
domain_name: 'sequoiacap.com',
|
||||
__typename: 'Company',
|
||||
},
|
||||
phone: '06 12 34 56 78',
|
||||
created_at: '2023-04-20T13:20:09.158312+00:00',
|
||||
|
||||
city: 'Paris',
|
||||
},
|
||||
|
||||
{
|
||||
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6h',
|
||||
__typename: 'Person',
|
||||
firstname: 'Janice',
|
||||
lastname: 'Dane',
|
||||
email: 'janice@facebook.com',
|
||||
company: {
|
||||
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6i',
|
||||
name: 'Facebook',
|
||||
domain_name: 'facebook.com',
|
||||
__typename: 'Company',
|
||||
},
|
||||
phone: '06 12 34 56 78',
|
||||
created_at: '2023-04-20T13:20:09.158312+00:00',
|
||||
|
||||
city: 'Paris',
|
||||
},
|
||||
];
|
||||
@ -22,7 +22,7 @@ exports[`PeopleFilter should render the filter company_name 1`] = `
|
||||
Object {
|
||||
"company": Object {
|
||||
"name": Object {
|
||||
"_eq": "ACME",
|
||||
"_eq": "Airbnb",
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -33,7 +33,7 @@ Object {
|
||||
"_not": Object {
|
||||
"company": Object {
|
||||
"name": Object {
|
||||
"_eq": "ACME",
|
||||
"_eq": "Airbnb",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@ -6,8 +6,8 @@ import {
|
||||
SEARCH_COMPANY_QUERY,
|
||||
SEARCH_PEOPLE_QUERY,
|
||||
} from '../../../services/search/search';
|
||||
import { mockCompanyData } from '../../companies/__stories__/mock-data';
|
||||
import { defaultData } from '../default-data';
|
||||
import { mockData as mockCompanyData } from '../../companies/__tests__/__data__/mock-data';
|
||||
import { mockData as mockPeopleData } from './__data__/mock-data';
|
||||
import { availableFilters } from '../people-table';
|
||||
|
||||
function assertFilterUseCompanySearch<FilterValue>(
|
||||
@ -32,7 +32,7 @@ function assertFilterUsePeopleSearch<FilterValue>(
|
||||
return filter.searchQuery === SEARCH_PEOPLE_QUERY;
|
||||
}
|
||||
|
||||
const JohnDoeUser = defaultData.find(
|
||||
const JohnDoeUser = mockPeopleData.find(
|
||||
(user) => user.email === 'john@linkedin.com',
|
||||
) as GraphqlQueryPerson;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user