Skip to content

Improve TestStore.init ergonomics #1857

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

Merged
merged 1 commit into from
Jan 23, 2023

Conversation

stephencelis
Copy link
Member

It's a bit easy to dive into testing and be met with bad ergonomics if you forgot to conform State to be Equatable. Right now it doesn't require Equatable because it's possible to scope test stores and assert against view state/actions. This feature is pretty niche, though, and shouldn't make the more general case painful, so let's take a few steps to improve things:

  1. We can deprecate the TestStore.init that takes non-equatable state
  2. We can introduce a TestStore.init(…:observe:send:…) for testing view state/actions.
  3. We can deprecate TestStore.scope (scoping a test store multiple times doesn't seem useful enough to support).

And introduce `TestStore.init(initialState:reducer:observe:send:)` for
testing scoped state and actions.
Copy link
Member

@mbrandonw mbrandonw left a comment

Choose a reason for hiding this comment

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

nice

@stephencelis stephencelis merged commit 0ed5c83 into main Jan 23, 2023
@stephencelis stephencelis deleted the deprecate-non-equatable-test-store-init branch January 23, 2023 18:44
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