Skip to content

Commit

Permalink
fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
c1495616js committed Dec 24, 2024
1 parent a986623 commit 53c0028
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions apps/web/tests/components/form/Search.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ describe('Search', () => {
it('renders a search box', async () => {
const mock = jest.fn();
const searchData = [
{ id: '1', name: 'Jane Doe', status: { id: 1, status: 'Recruitment' } },
{ id: '2', name: 'Mark Twain', status: { id: 5, status: 'Final Milestone' } },
{ ats1_id: '111111', id: '1', name: 'Jane Doe', status: { id: 1, status: 'Recruitment' } },
{
ats1_id: '222222',
id: '2',
name: 'Mark Twain',
status: { id: 5, status: 'Final Milestone' },
},
];
const search = async (): Promise<any[]> => searchData;

Expand All @@ -17,13 +22,9 @@ describe('Search', () => {

input.focus();
fireEvent.change(input, { target: { value: 'Mark' } });
for (const { name } of searchData) {
for (const { name, ats1_id } of searchData) {
await waitFor(() => {
expect(
screen.getByText((content, element) => {
return element?.textContent?.includes(name);
}),
).toBeInTheDocument();
expect(screen.getByText(`${ats1_id} - ${name}`)).toBeInTheDocument();
});
}

Expand Down

0 comments on commit 53c0028

Please sign in to comment.