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

feat(store): add refreshState method to mock store #2148

Merged
merged 2 commits into from
Oct 6, 2019

Conversation

brandonroberts
Copy link
Member

The MockStore.refreshState() method emits a clone of the existing
state on the state observable, that will cause the selectors to recompute.
This enables multiple calls of setResult for mocked selectors during testing.
Also fixes a bug with store.select not refreshing mocked selectors

Closes #2121

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[x] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

Closes #2121

What is the new behavior?

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

@ngrxbot
Copy link
Collaborator

ngrxbot commented Oct 4, 2019

Preview docs changes for 45b5327 at https://previews.ngrx.io/pr2148-45b5327/

The MockStore.refreshState() method emits a clone of the existing
state on the store observable, that will cause the selectors to recompute.
This enables multiple calls of setResult for mocked selectors during testing.
Also fixes a bug with store.select not refreshing mocked selectors

Closes #2121
@ngrxbot
Copy link
Collaborator

ngrxbot commented Oct 4, 2019

Preview docs changes for 603e09e at https://previews.ngrx.io/pr2148-603e09e/

@brandonroberts
Copy link
Member Author

brandonroberts commented Oct 4, 2019

cc: @tomastrajan. I tested these changes against your repo and it resolved the issue

@tomastrajan
Copy link

@brandonroberts thx mate, sounds amazing !

modules/store/testing/src/mock_store.ts Outdated Show resolved Hide resolved
modules/store/testing/src/mock_store.ts Outdated Show resolved Hide resolved
@ngrxbot
Copy link
Collaborator

ngrxbot commented Oct 5, 2019

Preview docs changes for a1f987d at https://previews.ngrx.io/pr2148-a1f987d/

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.

Re-triggering mock selectors
4 participants