-
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
chore: Add jest unit testing #67
Conversation
@@ -33,7 +33,7 @@ | |||
} | |||
} | |||
}, | |||
"report_table_data": { | |||
"amr_hit": { |
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.
Align to schema returned by resolver. This was preventing the tests from running, because the schema could not be generated
@@ -104,7 +104,7 @@ | |||
"type": "object", | |||
"properties": { | |||
"tax_id": { | |||
"type": "integer" | |||
"type": "string" |
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.
Align to schema returned by resolver. This was preventing the tests from running, because the schema could not be generated
@@ -12,4 +12,4 @@ jobs: | |||
runs-on: ubuntu-latest | |||
steps: | |||
- uses: actions/checkout@v3 | |||
- uses: chanzuckerberg/github-actions/.github/actions/conventional-commits@v1.3.2 | |||
- uses: chanzuckerberg/github-actions/.github/actions/conventional-commits@main |
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.
Since #61 was closed in favor of this PR, I am pulling this change in that was there.
57824be
to
9c2dd99
Compare
release: | ||
types: [published] |
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 is in preparation for changing the release cadence. stop pushing every PR to staging
I was able to remove the mock plugin, and instead, use jest mocking of our The warnings are a type issue in the mock plugin, which I've raised with The Guild team. With the removal of the mock plugin though, the warnings should no longer appear |
I verified locally that changing code in the |
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 think this looks great Jerry! Are you worried that it is too much work per test?
Thanks for reviewing @rainandbare! Are you referring to added engineering work to write these tests? My thought is that the amount of work to add these tests is inline with what I would expect for writing unit tests. It does add overhead per feature we develop, but I think it's worth it for future maintainability of the system. Hopefully, additional tests can follow the same patterns, and require less lift than this one did. |
Pull Request
JIRA Ticket
CZID-9015
Description
Add unit tests based on graphQL mesh examples.
tests/UnifiedSchema.test.ts
tests/ZipLinkQuery.test.ts
Notes
I originally mocked data with the
mock
plugin, but it was pointed out that this doesn't test our resolvers. I've switched approaches to mock data retrieval methods called by the resolvers. But I created a branch with the mock store approach, in case we want to use that in the future: https://github.com/chanzuckerberg/czid-graphql-federation-server/tree/testing-mock-store-exampleTests
This PR adds automated tests