Skip to content

Commit

Permalink
Adjust tests
Browse files Browse the repository at this point in the history
  • Loading branch information
xavierfacq committed Oct 5, 2023
1 parent 81514ec commit 8b70e6b
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,22 @@ describe('DocumentationHeader', () => {
});

test('renders component correctly', () => {
expect(screen.getByText('Documentation')).toBeInTheDocument();
expect(screen.getByRole('heading', { level: 1 })).toBeInTheDocument();
});

test('renders Autocomplete component', () => {
expect(screen.getByTestId('autocomplete')).toBeInTheDocument();
});

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();
Expand All @@ -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();
Expand Down

0 comments on commit 8b70e6b

Please sign in to comment.