-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add jest setup for site #395
base: main
Are you sure you want to change the base?
Conversation
6405046
to
78b1d4b
Compare
Do you have a real world example for a site test? |
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.
The tests aren't run in the test workflow. Could you please fix this? Thanks!
@@ -47,12 +50,18 @@ | |||
"@graphql-codegen/near-operation-file-preset": "^2.5.0", | |||
"@graphql-codegen/typescript": "^2.0.0", | |||
"@graphql-codegen/typescript-operations": "^2.0.0", | |||
"@testing-library/jest-dom": "^6.5.0", | |||
"@testing-library/react": "^16.0.1", |
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 add an example usage for testing library as well?
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.
Sure. Added tests for HiddenIfInvalidLink.tsx. ae2b484
site/jest.config.ts
Outdated
testEnvironment: "jsdom", | ||
setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"], | ||
// Add more setup options before each test is run | ||
// setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'], |
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.
This option is defined two lines above 😁 IMO we can remove all comments here
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.
done
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.
I'm not sure if we should add a tests folder for this.
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.
I prefer splitting tests and application code, but I can remove the __test__
folder when you don't like it.
What do you mean? I wrote tests for HiddenIfInvalidLink. |
I'm just curious and wanted to know what are you testing (or plan) in actual projects. |
We'll probably have few tests in the site in projects. I can think of some use cases for sites with more business logic, e.g., with an integrated shop. But it doesn't hurt to have the setup IMO. We could discuss whether we should have example tests as well. |
I'd like to see them :) (we should move this discussion into our slack) |
No description provided.