Skip to content

Add jest setup for site - #395

Closed
chernylu wants to merge 8 commits into
mainfrom
add-site-jest-setup
Closed

Add jest setup for site#395
chernylu wants to merge 8 commits into
mainfrom
add-site-jest-setup

Conversation

@chernylu

Copy link
Copy Markdown
Contributor

No description provided.

@chernylu
chernylu requested a review from johnnyomair October 14, 2024 08:57
@chernylu chernylu self-assigned this Oct 14, 2024
@chernylu
chernylu force-pushed the add-site-jest-setup branch from 6405046 to 78b1d4b Compare October 15, 2024 10:55
@nsams

nsams commented Oct 15, 2024

Copy link
Copy Markdown
Member

Do you have a real world example for a site test?

@johnnyomair johnnyomair left a comment

Copy link
Copy Markdown
Contributor

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!

Comment thread site/package.json
"@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",

Copy link
Copy Markdown
Contributor

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?

Copy link
Copy Markdown
Contributor Author

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

Comment thread 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'],

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor Author

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.

@chernylu

Copy link
Copy Markdown
Contributor Author

Do you have a real world example for a site test?

What do you mean? I wrote tests for HiddenIfInvalidLink.

@nsams

nsams commented Oct 28, 2024

Copy link
Copy Markdown
Member

What do you mean?

I'm just curious and wanted to know what are you testing (or plan) in actual projects.

@johnnyomair

Copy link
Copy Markdown
Contributor

Do you have a real world example for a site test?

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.

@nsams

nsams commented Oct 28, 2024

Copy link
Copy Markdown
Member

We'll probably have few tests in the site in projects.

I'd like to see them :) (we should move this discussion into our slack)

@VPS-thodax

Copy link
Copy Markdown
Contributor

Will be replaced by vivid-planet/dextinity#6289

@VPS-thodax VPS-thodax closed this Sep 4, 2026
@VPS-Obi
VPS-Obi deleted the add-site-jest-setup branch September 7, 2026 06:40
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.

5 participants