The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
test: wait for rows to be displayed
Sammy Teillet3a7b1077f8e6
diff --git a/front/src/components/table/Table.tsx b/front/src/components/table/Table.tsxindex 1a7b9cb9b75..7de44456be6 100644--- a/front/src/components/table/Table.tsx+++ b/front/src/components/table/Table.tsx@@ -100,8 +100,8 @@ function Table<TData>({))}</thead><tbody>- {table.getRowModel().rows.map((row) => (- <tr key={row.id}>+ {table.getRowModel().rows.map((row, index) => (+ <tr key={row.id} data-testid={`row-id-${row.index}`}>{row.getVisibleCells().map((cell) => {return (<td key={cell.id}>diff --git a/front/src/interfaces/person.interface.test.ts b/front/src/interfaces/person.interface.test.tsnew file mode 100644index 00000000000..e5c01f812a1--- /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.tsxindex ce20166a7b2..140004316e9 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(<PeopleDefault />);- 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.tsindex 4731d83d704..b0efc97a55a 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<Person> = [+export const defaultData: Array<GraphqlPerson> = [{- fullName: 'Alexandre Prot',- picture: 'http://placekitten.com/256',+ id: 1,+ __typename: 'Person',+ firstname: 'Alexandre',+ lastname: 'Prot',email: '[email protected]',- 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: '[email protected]',- 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: '[email protected]',- 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: '[email protected]',- 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',},];