diff --git a/front/src/components/table/Table.tsx b/front/src/components/table/Table.tsx index 1a7b9cb9b..7de44456b 100644 --- a/front/src/components/table/Table.tsx +++ b/front/src/components/table/Table.tsx @@ -100,8 +100,8 @@ function Table({ ))} - {table.getRowModel().rows.map((row) => ( - + {table.getRowModel().rows.map((row, index) => ( + {row.getVisibleCells().map((cell) => { return ( diff --git a/front/src/interfaces/person.interface.test.ts b/front/src/interfaces/person.interface.test.ts new file mode 100644 index 000000000..e5c01f812 --- /dev/null +++ b/front/src/interfaces/person.interface.test.ts @@ -0,0 +1,22 @@ +import { mapPerson } from './person.interface'; + +describe('mapPerson', () => { + it('should map person', () => { + const person = mapPerson({ + id: 1, + firstname: 'John', + lastname: 'Doe', + email: '', + phone: '', + city: '', + created_at: '', + company: { + __typename: '', + company_name: '', + company_domain: '', + }, + __typename: '', + }); + expect(person.fullName).toBe('John Doe'); + }); +}); diff --git a/front/src/pages/people/__tests__/People.test.tsx b/front/src/pages/people/__tests__/People.test.tsx index ce20166a7..140004316 100644 --- a/front/src/pages/people/__tests__/People.test.tsx +++ b/front/src/pages/people/__tests__/People.test.tsx @@ -1,10 +1,12 @@ -import { render } from '@testing-library/react'; +import { render, waitFor } from '@testing-library/react'; import { PeopleDefault } from '../__stories__/People.stories'; -it('Checks the People page render', () => { +it('Checks the People page render', async () => { const { getByTestId } = render(); - const title = getByTestId('top-bar-title'); - expect(title).toHaveTextContent('People'); + await waitFor(() => { + const personChip = getByTestId('row-id-0'); + expect(personChip).toBeDefined(); + }); }); diff --git a/front/src/pages/people/default-data.ts b/front/src/pages/people/default-data.ts index 4731d83d7..b0efc97a5 100644 --- a/front/src/pages/people/default-data.ts +++ b/front/src/pages/people/default-data.ts @@ -1,47 +1,69 @@ -import { Person } from '../../interfaces/person.interface'; +import { GraphqlPerson } from '../../interfaces/person.interface'; -export const defaultData: Array = [ +export const defaultData: Array = [ { - fullName: 'Alexandre Prot', - picture: 'http://placekitten.com/256', + id: 1, + __typename: 'Person', + firstname: 'Alexandre', + lastname: 'Prot', email: 'alexandre@qonto.com', - company: { id: 1, name: 'Qonto', domain: 'qonto.com' }, + company: { + company_name: 'Qonto', + company_domain: 'qonto.com', + __typename: 'Company', + }, phone: '06 12 34 56 78', - creationDate: new Date('Feb 23, 2018'), - pipe: { id: 1, name: 'Sales Pipeline', icon: 'faUser' }, + created_at: '2023-04-20T13:20:09.158312+00:00', + city: 'Paris', - countryCode: 'FR', }, { - fullName: 'Alexandre Prot', + id: 2, + __typename: 'Person', + firstname: 'Alexandre', + lastname: 'Prot', email: 'alexandre@qonto.com', - company: { id: 2, name: 'LinkedIn', domain: 'linkedin.com' }, + company: { + company_name: 'LinkedIn', + company_domain: 'linkedin.com', + __typename: 'Company', + }, phone: '06 12 34 56 78', - creationDate: new Date('Feb 22, 2018'), - pipe: { id: 1, name: 'Sales Pipeline', icon: 'faUser' }, + created_at: '2023-04-20T13:20:09.158312+00:00', + city: 'Paris', - countryCode: 'FR', }, { - fullName: 'Alexandre Prot', - picture: 'http://placekitten.com/256', + id: 3, + __typename: 'Person', + firstname: 'Alexandre', + lastname: 'Prot', email: 'alexandre@qonto.com', - company: { id: 5, name: 'Sequoia', domain: 'sequoiacap.com' }, + company: { + company_name: 'Sequoia', + company_domain: 'sequoiacap.com', + __typename: 'Company', + }, phone: '06 12 34 56 78', - creationDate: new Date('Feb 21, 2018'), - pipe: { id: 1, name: 'Sales Pipeline', icon: 'faUser' }, + created_at: '2023-04-20T13:20:09.158312+00:00', + city: 'Paris', - countryCode: 'FR', }, { - fullName: 'Alexandre Prot', + id: 4, + __typename: 'Person', + firstname: 'Alexandre', + lastname: 'Prot', email: 'alexandre@qonto.com', - company: { id: 2, name: 'Facebook', domain: 'facebook.com' }, + company: { + company_name: 'Facebook', + company_domain: 'facebook.com', + __typename: 'Company', + }, phone: '06 12 34 56 78', - creationDate: new Date('Feb 25, 2018'), - pipe: { id: 1, name: 'Sales Pipeline', icon: 'faUser' }, + created_at: '2023-04-20T13:20:09.158312+00:00', + city: 'Paris', - countryCode: 'FR', }, ];