From 8b70e6bce3fcace189464b341beada0e186b2433 Mon Sep 17 00:00:00 2001 From: Xavier FACQ Date: Thu, 5 Oct 2023 13:44:03 +0200 Subject: [PATCH] Adjust tests --- .../__tests__/DocumentionHeader.test.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/DocumentationHeader/__tests__/DocumentionHeader.test.tsx b/src/components/DocumentationHeader/__tests__/DocumentionHeader.test.tsx index ca046f248..367317bf8 100644 --- a/src/components/DocumentationHeader/__tests__/DocumentionHeader.test.tsx +++ b/src/components/DocumentationHeader/__tests__/DocumentionHeader.test.tsx @@ -44,7 +44,7 @@ describe('DocumentationHeader', () => { }); test('renders component correctly', () => { - expect(screen.getByText('Documentation')).toBeInTheDocument(); + expect(screen.getByRole('heading', { level: 1 })).toBeInTheDocument(); }); test('renders Autocomplete component', () => { @@ -52,13 +52,14 @@ describe('DocumentationHeader', () => { }); test('renders TextField component', () => { - expect(screen.getByLabelText('Start typing to search the docs...')).toBeInTheDocument(); + const autocomplete = screen.getByTestId('autocomplete'); + expect(within(autocomplete).getByLabelText('Text')).toBeInTheDocument(); }); test("filters search results based on search query", () => { const autocomplete = screen.getByTestId('autocomplete'); const input: HTMLInputElement = within(autocomplete).getByLabelText( - "Start typing to search the docs..." + "Text" ) as HTMLInputElement; autocomplete.focus(); @@ -80,7 +81,7 @@ describe('DocumentationHeader', () => { test("redirects the user to the selected option's link on Autocomplete onChange event", () => { const autocomplete = screen.getByTestId('autocomplete'); const input: HTMLInputElement = within(autocomplete).getByLabelText( - "Start typing to search the docs..." + "Text" ) as HTMLInputElement; autocomplete.focus();