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

Potential approaches for allowing mocked state #72

Closed
wants to merge 2 commits into from

Conversation

elihart
Copy link
Contributor

@elihart elihart commented Aug 30, 2018

Playing with some ways to mock out state for testing. Each commit here is a separate approach.

Use an intermediate mocker singleton to control all mocked state
6ffc9c7

Set a mock provider on the view model
d508554

Definitely want to avoid making it too easy to set state so people don't use this outside of testing.

Copy link
Contributor

@hellohuanlin hellohuanlin left a comment

Choose a reason for hiding this comment

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

both approaches look reasonable to me.

stateStore.set(reducer)
when {
debugMode -> // Must use `set` to ensure the validated state is the same as the actual state used in reducer
// Do not use `get` since `getState` queue has lower priority and the validated state would be the state after reduced
Copy link
Contributor

Choose a reason for hiding this comment

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

these 2 comments are outdated. can you delete them?

@mmcwong
Copy link
Contributor

mmcwong commented Aug 31, 2018

I agree both approaches seem like they would work. I kind of like being able to have all the mock states for different view models in one place and a single place to enable/disable all of them though.

@elihart
Copy link
Contributor Author

elihart commented Sep 6, 2018

Closed in favor or #81

@elihart elihart closed this Sep 6, 2018
@elihart elihart deleted the eli-mvrx_mock branch September 18, 2020 19:46
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.

3 participants