Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests/dashboard page #547

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from
Open

Tests/dashboard page #547

wants to merge 13 commits into from

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.
6 participants