Stylianos Gakis
03/20/2025, 2:05 PMmemberUpdateEmail(input: MemberUpdateEmailInput!): MemberMutationOutput!
memberUpdateLanguage(input: MemberUpdateLanguageInput!): MemberMutationOutput!
notice the same response type on both of them.
I was writing some tests, and I was enqueuing some responses like this:
apolloClient.registerSuspendingTestResponse(
MemberUpdatePhoneNumberMutation(newPhoneNumber),
MemberUpdatePhoneNumberMutation.Data {
this.memberUpdatePhoneNumber = this.buildMemberMutationOutput { ... irrelevant what's in here }
},
)
apolloClient.registerSuspendingTestResponse(
MemberUpdateEmailMutation(newEmail),
MemberUpdateEmailMutation.Data {
this.memberUpdatePhoneNumber = this.buildMemberMutationOutput { ... }
},
)
And I could not for the life of me figure out why my tests were failing but it was all here
MemberUpdateEmailMutation.Data {
this.memberUpdatePhoneNumber = this.buildMemberMutationOutput { ... }
},
Which should have instead been
MemberUpdateEmailMutation.Data {
this.memberUpdateEmail = this.buildMemberMutationOutput { ... }
},
Notice the difference in which field I am defining in the lambda there? And there was no type-safety related error kicking in here since they both happen to accept the same response type, so it was compiling just fine.
Lmk if what I say is clear enough or not 🤗mbonnin
03/20/2025, 3:01 PMmbonnin
03/20/2025, 3:02 PMmbonnin
03/20/2025, 3:02 PMmbonnin
03/20/2025, 3:03 PMStylianos Gakis
03/20/2025, 3:11 PM.Data { }
lambda, right?
The alternative of going down to MockServer would make everything even less type-safe as far as I understand, since then it'd be a matter of hand-writing JSON responses, so I wouldn't be gaining anything by looking there either.mbonnin
03/20/2025, 3:20 PMmbonnin
03/20/2025, 3:21 PMStylianos Gakis
03/20/2025, 3:48 PMmbonnin
03/20/2025, 3:49 PM