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

Fix/image methods mock in jest setup #43497

Closed

Conversation

delphinebugner
Copy link
Contributor

Summary:

Context

This is what this PR intends to do.

Content

Along fixing the Image module mock in jest.setup, this PR :

  • adds unit test on each one of the methods, ensuring they have a consistent behavior even when the module is mocked.
  • adds 3 missing native mocks for NativeImageLoader: prefetchImageWithMetadata, getSizeWithHeaders & queryCache. After this PR, no method from NativeImageLoader remains unmocked.

Changelog:

[GENERAL][FIXED] - fix jest setup for Image methods (resolveAssetSource, getSize, prefetch, queryCache)

Test Plan:

See exhaustive unit tests in PR.

You can re-use the mock with all the methods mocked and see how the new unit tests fail.

I also patched those changes on my project: my snapshot did have their URL back (see demonstrative screenshots in my original PR: #41957 - NB; fixed mock was different but result was the same -> those screenshots cover only two cases, but anyway they illustrate well the case!)

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Mar 14, 2024
@ryancat
Copy link
Contributor

ryancat commented Mar 15, 2024

Thanks for adding the additional tests in this PR!

@facebook-github-bot
Copy link
Contributor

@tdn120 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Mar 18, 2024
@facebook-github-bot
Copy link
Contributor

@tdn120 merged this pull request in d53cc2b.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants