-
Notifications
You must be signed in to change notification settings - Fork 25k
[Codegen] Improve assertGenericTypeAnnotationHasExactlyOneTypeParameter tests #34942
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
Conversation
| const flowTypeAnnotation = { | ||
| typeParameters: { | ||
| type: 'TypeParameterInstantiation', | ||
| type: 'wrongType', |
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.
This test case was ok because an Error was thrown even though the type had the correct value.
It was the fact that params was missing that caused an Error to be thrown.
cipolleschi
left a comment
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.
Hi @AntoineDoubovetzky, thanks a lot for this extra PR that shows how much you care. 🥰
Can you fix the linting error? It looks like there is an unused variable in the code!
Base commit: f353119 |
Base commit: f353119 |
|
@cipolleschi Sorry I didn't notice the unused import. I removed it! |
cipolleschi
left a comment
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.
Sorry, I missed this! It looks good!
|
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
This pull request was successfully merged by @AntoineDoubovetzky in 790f40c. When will my fix make it into a release? | Upcoming Releases |
…acebook#34942) Summary: facebook#34933 has been merged just after I pushed a new commit to the branch to improve tests of `assertGenericTypeAnnotationHasExactlyOneTypeParameter` function, but the last commit was not imported to the internal repository. The `assertGenericTypeAnnotationHasExactlyOneTypeParameter` can throw different types of Error, and I believe that `.toThrow(Error)` is not specific enough. So I replaced it with `toThrowErrorMatchingInlineSnapshot()`. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [Internal] [Changed] - Improve assertGenericTypeAnnotationHasExactlyOneTypeParameter tests in parsers-commons Pull Request resolved: facebook#34942 Test Plan: Some test cases were ok because the assertGenericTypeAnnotationHasExactlyOneTypeParameter function threw an Error, but for the wrong reason. I've made sure that the error displayed in the inline snapshot is the one we expect. Reviewed By: cortinico Differential Revision: D40384993 Pulled By: cipolleschi fbshipit-source-id: aaa943be1e808af2c5131f7d06baf24bc3bffa31
Summary
#34933 has been merged just after I pushed a new commit to the branch to improve tests of
assertGenericTypeAnnotationHasExactlyOneTypeParameterfunction, but the last commit was not imported to the internal repository.The
assertGenericTypeAnnotationHasExactlyOneTypeParametercan throw different types of Error, and I believe that.toThrow(Error)is not specific enough. So I replaced it withtoThrowErrorMatchingInlineSnapshot().Changelog
[Internal] [Changed] - Improve assertGenericTypeAnnotationHasExactlyOneTypeParameter tests in parsers-commons
Test Plan
Some test cases were ok because the assertGenericTypeAnnotationHasExactlyOneTypeParameter function threw an Error, but for the wrong reason. I've made sure that the error displayed in the inline snapshot is the one we expect.