Skip to content

Conversation

@kirontoo
Copy link
Contributor

No description provided.

@kirontoo kirontoo requested a review from ShelbsH July 16, 2021 02:48
Copy link
Contributor

@ShelbsH ShelbsH 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 👍 Just a small change.

Comment on lines +6 to +12
test("pages renders correctly", () => {
const {queryByLabelText, queryByRole} = render(<Signup/>);
expect(queryByLabelText("Email")).toBeTruthy();
expect(queryByLabelText("Password")).toBeTruthy();
expect(queryByRole("button")).toBeVisible();
//TODO: check if button is rendered.
});
Copy link
Contributor

Choose a reason for hiding this comment

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

If you're just testing if elements are rendered into the DOM, you can use the same methods from screen. This avoids having to keep using destructuring queries from render(...). Kent Dodds talks about it here.

Since you're using jest-dom, you could change .toBeTruthy() to be toBeInTheDocument(), since it's a little more accurate in stating that those elements are rendered. The same for the button as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

:+1 @shelbyhurns

Copy link
Contributor

@vijayxtreme vijayxtreme left a comment

Choose a reason for hiding this comment

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

Looking good -- just be sure to add more test coverage. Please run npx jest --coverage on any of your work

@vijayxtreme
Copy link
Contributor

Please use "squash and merge" when you are finished so we can roll all these updates into one commit.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants