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

component tests linting fixes #1311

Closed
wants to merge 7 commits into from

Conversation

goosewobbler
Copy link
Contributor

@goosewobbler goosewobbler commented Dec 30, 2022

Fixing linting issues in the components tests and some associated refactoring

@@ -18,3 +18,5 @@ export function setupComponent(jsx, options = {}) {
...render(jsx)
}
}

export * from '@testing-library/react'
Copy link
Collaborator

Choose a reason for hiding this comment

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

@goosewobbler I think the changes to use screen throughout the tests based on the linting rules make sense, but we still want to call setupUser() before ever render to make sure we're using a new instance of the user object each time.

I updated this file to be more in line with the recommended way to use a setup file based on these docs:
https://testing-library.com/docs/react-testing-library/setup
https://testing-library.com/docs/user-event/intro#writing-tests-with-userevent

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think one more improvement would be to export the setupComponent method as render and always use that in every test as suggested in the docs. I updated this test file as a sample of how it can look when everything is put together: test/app/dash/Accounts/Add/AddPhrase/index.test.js

@goosewobbler
Copy link
Contributor Author

Closing in favour of #1334

@mholtzman mholtzman deleted the linting-fixes-renderer-tests branch August 10, 2023 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants