Skip to content

Conversation

judofyr
Copy link
Contributor

@judofyr judofyr commented Sep 26, 2025

Description

Many of the React tests were mocking the useSanityInstance hook. This is unfortunate because it depends on internals (the fact that it invokes that specific hook) which we might want to change. This replaces all of these mocks by using the ResourceProvider. This makes the test closer to the public API and less likely to have to change if we want to change the internals.

What to review

  • Does it still test the same behavior?

Testing

N/A.

Fun gif

Friday

@judofyr judofyr self-assigned this Sep 26, 2025
@judofyr judofyr requested a review from a team as a code owner September 26, 2025 12:09
@judofyr judofyr requested a review from binoy14 September 26, 2025 12:09
Copy link

vercel bot commented Sep 26, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
sdk-docs Ready Ready Preview Comment Sep 26, 2025 0:16am
sdk-kitchensink-react Ready Ready Preview Comment Sep 26, 2025 0:16am

This is easily replaced by actually placing a real instance in the context.
Copy link
Contributor

@binoy14 binoy14 left a comment

Choose a reason for hiding this comment

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

Looks good to me.

In future we should abstract this into renderWithProvider helper but that probably is out of scope for this PR

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.

2 participants