-
Notifications
You must be signed in to change notification settings - Fork 160
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
base: develop
Are you sure you want to change the base?
Tests/dashboard page #547
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this 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); |
There was a problem hiding this comment.
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
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(); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add tests for the standup dashboard page and search bar component
Test Coverage: