From 53c00282e5c9271f5e29623a93b4fec1724c5053 Mon Sep 17 00:00:00 2001 From: Jerry Wang Date: Tue, 24 Dec 2024 11:28:54 -0800 Subject: [PATCH] fix unit test --- apps/web/tests/components/form/Search.test.tsx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/apps/web/tests/components/form/Search.test.tsx b/apps/web/tests/components/form/Search.test.tsx index e2d2413a6..a7930ff86 100644 --- a/apps/web/tests/components/form/Search.test.tsx +++ b/apps/web/tests/components/form/Search.test.tsx @@ -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 => searchData; @@ -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(); }); }