Skip to content
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

Add test for when JSONResponseParsingError.noResponseToParse is called #2903

Merged
merged 6 commits into from Mar 29, 2023
Merged

Add test for when JSONResponseParsingError.noResponseToParse is called #2903

merged 6 commits into from Mar 29, 2023

Conversation

tokizuoh
Copy link
Contributor

Add test where an unintended call to the JSONResponseParsingInterceptor is made and verify that the error is .noResponseToParse in the completion handler.

@netlify
Copy link

netlify bot commented Mar 25, 2023

👷 Deploy request for apollo-ios-docs pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit f994966

@calvincestari
Copy link
Member

Thanks for the PR @tokizuoh. You mentioned "unintended call", did you encounter this in general operation of the interceptor chain?

@tokizuoh
Copy link
Contributor Author

Thank you for replying @calvincestari !

No, I did not encounter it during the general operation of the interceptor chain. I only added it because there was no test code for the defined error. I have not actually encountered it in practice.

@calvincestari
Copy link
Member

We now have the MockInterceptorProvider class so we can probably cleanup the tests here and reuse some of the more recently added test helpers.

Would you like to do that, I'm happy to take it on if not.

…ParsingError.noResponseToParse is called"

This reverts commit 3de56438e3c5e1e34577ee3aad158932a1638d56.
…son-response-parsing-error-no-response-to-parse
for testJSONResponseParsingInterceptorFailsWithImproperlyOrderedCalls()
@tokizuoh
Copy link
Contributor Author

MockInterceptorProvider class is good! I tried to use it.

043459b

@tokizuoh
Copy link
Contributor Author

@calvincestari

I would like to update other tests with another Pull-Request if 043459b's policy looks good.

func testJSONResponseParsingInterceptorFailsWithEmptyData() etc.

@calvincestari
Copy link
Member

I would like to update other tests with another Pull-Request if 043459b8685e70fc595465af61f412ae13d4a292's policy looks good.

Yes that's what I meant; cleaning up this whole test file. You can do it all in this PR, I don't think we need another one.

for testJSONResponseParsingInterceptorFailsWithEmptyData()
@tokizuoh
Copy link
Contributor Author

OK! I agree.
I changed it in f994966.

Copy link
Member

@calvincestari calvincestari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I renamed the new test but looks good otherwise. I'll get this merged now, thanks for the contribution @tokizuoh.

@calvincestari calvincestari merged commit 77c8e3e into apollographql:main Mar 29, 2023
@tokizuoh
Copy link
Contributor Author

The renaming makes it easier to understand. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants