Skip to content

Conversation

@RitikJaiswal75
Copy link
Contributor

@RitikJaiswal75 RitikJaiswal75 commented May 11, 2023

Add tests for the standup dashboard page and search bar component

Test Coverage:
image

image

image

@vercel
Copy link

vercel bot commented May 11, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
status-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 30, 2023 6:16pm

Copy link
Contributor

@bhtibrewal bhtibrewal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work on the tests, left 2 small comments


fireEvent.keyDown(input, { key: 'A', code: 'KeyA' });

expect(splitNSearch).toBeCalledTimes(2);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we reset the times called?
If some new tests above are added which do the same or we update some, then the rest of the test will fail as toBeCalledTimes would change

And when reading the title of the tests, and seeing the times it called its a little bit confusing as I would have thought it to be 0, but seeing it 2 will have to see actually how many times its being called

Comment on lines +16 to +23
const searchBar = screen.getByRole('textbox');
expect(searchBar).toBeInTheDocument();

const searchButton = screen.getByRole('button');
expect(searchButton.innerHTML).toBe('Search');

const label = screen.getByLabelText('Users');
expect(label).toBeInTheDocument();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use test selector to get the components on the page?
If some new button or some new element is added in the file before the search button, won't the test fail?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this you can use screen.getByRole('button', { name: 'Search'}); This would get the specific element with role button and with text "Search".

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests 008672

Projects

None yet

Development

Successfully merging this pull request may close these issues.

write test for the standup dashboard feature.

7 participants