-
Notifications
You must be signed in to change notification settings - Fork 163
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
[Draft] using react-testing-library to test useGroups hook #1530
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @christianvogt. Thanks for your PR. I'm waiting for a opendatahub-io member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/ok-to-test |
Just a few tips before readying this branch:
Otherwise the changes look really great, I'm looking forward to keeping on improving our testing efforts! |
@lucferbux Thanks for the insights. |
Based on PR #1528 - creating unit tests for
useGroups
hook.Tests using react-testing-library
Commit: 46fa36d
npm run test:jest useGroups
Used
jest.mock
to mock thek8s
api from@openshift/dynamic-plugin-sdk-utils
. It's likely possible to instead use mock service worker (the utility used by our storybook tests) with jest.Tests using storybook & playwright
Commit: c0b270b
npx playwright test ./src/__tests__/integration/hooks/useGroups.spec.ts
These tests do not assert whether the hook performs a 2nd network request after receiving a
403
error. Not sure how this can be asserted. Mock service worker discourages such assertions.Further investigations required:
2s
waits are required => Could use specific selectors instead to wait till present.