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

Feature request 241: reuse mocks in MockLink / MockedProvider #11178

Merged

Conversation

sebakerckhof
Copy link
Contributor

Useful for using MockedProvider in storybook or in tests where we want to test for intervals etc.

Link to feature request: apollographql/apollo-feature-requests#274

I went with one of the suggestions in that discussion to introduce a 'reuse' variable. But open for other suggestions

@sebakerckhof sebakerckhof requested a review from a team as a code owner August 29, 2023 13:41
@netlify
Copy link

netlify bot commented Aug 29, 2023

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

Visit the deploys page to approve it

Name Link
🔨 Latest commit 53e494f

@changeset-bot
Copy link

changeset-bot bot commented Aug 29, 2023

🦋 Changeset detected

Latest commit: fd5b55f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@apollo/client Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@jerelmiller jerelmiller changed the base branch from main to release-3.9 August 30, 2023 04:00
@jerelmiller
Copy link
Member

Hey @sebakerckhof 👋

Appreciate the PR! FYI, I've pointed this at our 3.9 release branch since its a both a new feature and you've indicated this as a minor version change.

Copy link
Member

@jerelmiller jerelmiller left a comment

Choose a reason for hiding this comment

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

I'd love for @alessbell to have a look at this as well since she is currently focusing on some improvements to test utilities and I'm sure will have some thoughts.

Really appreciate the contribution here @sebakerckhof!! I think this will make a nice addition to the library 🎉

src/testing/core/mocking/mockLink.ts Outdated Show resolved Hide resolved
src/testing/core/mocking/mockLink.ts Outdated Show resolved Hide resolved
docs/source/development-testing/testing.mdx Outdated Show resolved Hide resolved
src/testing/react/__tests__/MockedProvider.test.tsx Outdated Show resolved Hide resolved
src/testing/react/__tests__/MockedProvider.test.tsx Outdated Show resolved Hide resolved
src/testing/react/__tests__/MockedProvider.test.tsx Outdated Show resolved Hide resolved
Copy link
Member

@jerelmiller jerelmiller left a comment

Choose a reason for hiding this comment

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

This is a great quality of life improvement that I think many will find useful. Appreciate you picking this up!

As mentioned, I'd like @alessbell to take a look at this as well, but from my side, this looks great 🎉

src/testing/react/__tests__/MockedProvider.test.tsx Outdated Show resolved Hide resolved
src/testing/react/__tests__/MockedProvider.test.tsx Outdated Show resolved Hide resolved
@jerelmiller
Copy link
Member

FYI, I've run prettier on the MockedProvider test and pushed in 4b2d3c9

@alessbell
Copy link
Member

Thanks for your patience, @sebakerckhof! With #6701 merged, there are a few conflicts - I can take a pass at resolving them, unless you'd prefer to look at those yourself, though I'm also at a conference this week so hopefully by Friday I'll be able to get this wrapped up. Thanks!

Copy link
Member

@alessbell alessbell left a comment

Choose a reason for hiding this comment

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

Thanks for jumping on updating the PR, @sebakerckhof! This LGTM - excited to get this out in the next 3.9 alpha 🙌

}

// @public (undocumented)
class SuspenseCache_2 {
Copy link
Member

Choose a reason for hiding this comment

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

I'm confused as to why these SuspenseCache updates are here @phryneas - this branch has your recent commit that landed on main that removed it... I'm going to merge this PR anyways and we can address this elsewhere if it's unintended, but wanted to flag it 👍

Copy link
Member

Choose a reason for hiding this comment

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

Ah whoops, I had an old version in dist and didn't realize. Made a small tweak to the script so it's impossible to make this mistake again :) 1fc9df6

@alessbell alessbell merged commit 4d64a6f into apollographql:release-3.9 Sep 21, 2023
24 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants