test: wait for rows to be displayed
This commit is contained in:
@ -100,8 +100,8 @@ function Table<TData>({
|
|||||||
))}
|
))}
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{table.getRowModel().rows.map((row) => (
|
{table.getRowModel().rows.map((row, index) => (
|
||||||
<tr key={row.id}>
|
<tr key={row.id} data-testid={`row-id-${row.index}`}>
|
||||||
{row.getVisibleCells().map((cell) => {
|
{row.getVisibleCells().map((cell) => {
|
||||||
return (
|
return (
|
||||||
<td key={cell.id}>
|
<td key={cell.id}>
|
||||||
|
|||||||
22
front/src/interfaces/person.interface.test.ts
Normal file
22
front/src/interfaces/person.interface.test.ts
Normal file
@ -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');
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -1,10 +1,12 @@
|
|||||||
import { render } from '@testing-library/react';
|
import { render, waitFor } from '@testing-library/react';
|
||||||
|
|
||||||
import { PeopleDefault } from '../__stories__/People.stories';
|
import { PeopleDefault } from '../__stories__/People.stories';
|
||||||
|
|
||||||
it('Checks the People page render', () => {
|
it('Checks the People page render', async () => {
|
||||||
const { getByTestId } = render(<PeopleDefault />);
|
const { getByTestId } = render(<PeopleDefault />);
|
||||||
|
|
||||||
const title = getByTestId('top-bar-title');
|
await waitFor(() => {
|
||||||
expect(title).toHaveTextContent('People');
|
const personChip = getByTestId('row-id-0');
|
||||||
|
expect(personChip).toBeDefined();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -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',
|
id: 1,
|
||||||
picture: 'http://placekitten.com/256',
|
__typename: 'Person',
|
||||||
|
firstname: 'Alexandre',
|
||||||
|
lastname: 'Prot',
|
||||||
email: 'alexandre@qonto.com',
|
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',
|
phone: '06 12 34 56 78',
|
||||||
creationDate: new Date('Feb 23, 2018'),
|
created_at: '2023-04-20T13:20:09.158312+00:00',
|
||||||
pipe: { id: 1, name: 'Sales Pipeline', icon: 'faUser' },
|
|
||||||
city: 'Paris',
|
city: 'Paris',
|
||||||
countryCode: 'FR',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fullName: 'Alexandre Prot',
|
id: 2,
|
||||||
|
__typename: 'Person',
|
||||||
|
firstname: 'Alexandre',
|
||||||
|
lastname: 'Prot',
|
||||||
email: 'alexandre@qonto.com',
|
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',
|
phone: '06 12 34 56 78',
|
||||||
creationDate: new Date('Feb 22, 2018'),
|
created_at: '2023-04-20T13:20:09.158312+00:00',
|
||||||
pipe: { id: 1, name: 'Sales Pipeline', icon: 'faUser' },
|
|
||||||
city: 'Paris',
|
city: 'Paris',
|
||||||
countryCode: 'FR',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fullName: 'Alexandre Prot',
|
id: 3,
|
||||||
picture: 'http://placekitten.com/256',
|
__typename: 'Person',
|
||||||
|
firstname: 'Alexandre',
|
||||||
|
lastname: 'Prot',
|
||||||
email: 'alexandre@qonto.com',
|
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',
|
phone: '06 12 34 56 78',
|
||||||
creationDate: new Date('Feb 21, 2018'),
|
created_at: '2023-04-20T13:20:09.158312+00:00',
|
||||||
pipe: { id: 1, name: 'Sales Pipeline', icon: 'faUser' },
|
|
||||||
city: 'Paris',
|
city: 'Paris',
|
||||||
countryCode: 'FR',
|
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
fullName: 'Alexandre Prot',
|
id: 4,
|
||||||
|
__typename: 'Person',
|
||||||
|
firstname: 'Alexandre',
|
||||||
|
lastname: 'Prot',
|
||||||
email: 'alexandre@qonto.com',
|
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',
|
phone: '06 12 34 56 78',
|
||||||
creationDate: new Date('Feb 25, 2018'),
|
created_at: '2023-04-20T13:20:09.158312+00:00',
|
||||||
pipe: { id: 1, name: 'Sales Pipeline', icon: 'faUser' },
|
|
||||||
city: 'Paris',
|
city: 'Paris',
|
||||||
countryCode: 'FR',
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user