-
Notifications
You must be signed in to change notification settings - Fork 22
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: Migrate updateProfile to ts #3607
Conversation
Codecov ReportAttention: Patch coverage is ✅ All tests successful. No failed tests found.
@@ Coverage Diff @@
## main #3607 +/- ##
==========================================
- Coverage 98.99% 98.98% -0.01%
==========================================
Files 810 810
Lines 14556 14562 +6
Branches 4147 4148 +1
==========================================
+ Hits 14409 14414 +5
- Misses 140 141 +1
Partials 7 7
Continue to review full report in Codecov by Sentry.
|
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
@@ Coverage Diff @@
## main #3607 +/- ##
==========================================
- Coverage 98.99% 98.98% -0.01%
==========================================
Files 810 810
Lines 14556 14562 +6
Branches 4147 4141 -6
==========================================
+ Hits 14409 14414 +5
- Misses 140 141 +1
Partials 7 7
Continue to review full report in Codecov by Sentry.
|
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## main #3607 +/- ##
==========================================
- Coverage 98.99% 98.98% -0.01%
==========================================
Files 810 810
Lines 14556 14562 +6
Branches 4140 4141 +1
==========================================
+ Hits 14409 14414 +5
- Misses 140 141 +1
Partials 7 7
Continue to review full report in Codecov by Sentry.
|
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
@@ Coverage Diff @@
## main #3607 +/- ##
==========================================
- Coverage 98.99% 98.98% -0.01%
==========================================
Files 810 810
Lines 14556 14562 +6
Branches 4140 4148 +8
==========================================
+ Hits 14409 14414 +5
- Misses 140 141 +1
Partials 7 7
Continue to review full report in Codecov by Sentry.
|
Bundle ReportChanges will increase total bundle size by 1.79kB (0.01%) ⬆️. This is within the configured threshold ✅ Detailed changes
|
Bundle ReportChanges will increase total bundle size by 1.79kB (0.01%) ⬆️. This is within the configured threshold ✅ Detailed changes
|
✅ Deploy preview for gazebo ready!Previews expire after 1 month automatically.
|
@@ -50,9 +50,13 @@ describe('useUpdateProfile', () => { | |||
server.use( | |||
graphql.mutation('UpdateProfile', (info) => { | |||
const newUser = { | |||
...user, | |||
name: info.variables.input.name, | |||
email: info.variables.input.email, |
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 existing mocks didn't match the current shape of response so updated
]) | ||
) | ||
|
||
const CurrentUserFragment = z.object({ |
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.
can we export this from useUser
and just use one?
Looks like some of the values there are non nullish which match the api (ex: onboardingCompleted)
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 get what you mean, the duplication is not great. Unfortunately I feel like unless we share the graphQL query/fragment across both hooks too, we should keep the response zod schema validations independent so the given hook's paired query + response validation zod doesn't diverge. For example, termsAgreement
is part of the useUser query but omitted here (perhaps that's its own oversight) so can't share a zod schema validation that includes that field.
Re: non-nullish - yeah, on that one I left it loose for the client to handle these values being undefined (and less trust in the api). I made it a bit stricter now to match that in useUser, and updated the test mocks too.
Adds zod schema validation to the hook to close out the TS migration work for this hook. Note that I was getting mixed results with the api on what fields are null or undefined so any users of this hook (just the 1 place to update profile) should assume the api contract unreliable and handle if field is undefined.
Also did end to end testing in local (against staging api)
Closes codecov/engineering-team#2861