-
Notifications
You must be signed in to change notification settings - Fork 702
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
Remove repo secrets from redux state, fetch on mount #4028
Conversation
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.
Great, happy to see we're getting rid of unexpected direct calls to the k8s API.
Certainly, we should explore the capabilities of the "testing library" when implementing future tests.
@@ -75,6 +75,7 @@ | |||
"devDependencies": { | |||
"@formatjs/cli": "^4.7.0", | |||
"@improbable-eng/grpc-web-fake-transport": "^0.15.0", | |||
"@testing-library/react": "^12.1.2", |
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.
Adding the testing library seems to be the first step towards getting rid of Enzyme: https://testing-library.com/docs/react-testing-library/migrate-from-enzyme :P
wrapper = mountWrapper(defaultStore, <AppRepoForm {...defaultProps} repo={repo} />); | ||
}); | ||
|
||
await waitFor(() => { |
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.
Way simpler than the tricky approach with jest.runAllTimers()
we still have in some places.
Signed-off-by: Michael Nelson <minelson@vmware.com>
Signed-off-by: Michael Nelson <minelson@vmware.com>
Signed-off-by: Michael Nelson <minelson@vmware.com>
772011e
to
ef86572
Compare
Description of the change
Following on from #4027, this PR updates the AppRepoForm component so that it no longer receives a related secret as a prop (from the redux state?), but rather fetches the secret when mounting and uses the local component state.
Benefits
The new endpoint for fetching a secret for a repo's secret is used (rather than the k8s API), and it avoids the need to update the redux state when a repo is updated (since we always fetch the secret when loading the form). Also avoids storing all repo secrets in the redux state (and removes the related actions/reducers).
Possible drawbacks
Applicable issues
Additional information
As always, testing the combination of an async react hook (useEffect) turned out to be painful to realise, but got there after a lot of head scratching.
I still need to test this IRL locally before landing (once CI passes etc.)