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 clearResult to reset a mock selector #2270

Merged
merged 1 commit into from
Jan 8, 2020

Conversation

timdeschryver
Copy link
Member

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] 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?

Calling mockSelector.setValue(undefined), does a reset the mocked selector.

Closes #2244

What is the new behavior?

Calling mockSelector.setValue(undefined), sets the result to undefined.
To reset a mock selector, use mockSelector.clearResult().

Does this PR introduce a breaking change?

[x] Yes
[ ] No
BREAKING CHANGE:

BEFORE:

Using `mockSelector.setResult(undefined)` resulted in clearing the
return value.

AFTER:

Using `mockSelector.setResult(undefined)` will set the return value of
the selector to `undefined`.
To reset the mock selector, use `mockSelector.clearResult()`.

BREAKING CHANGE:

BEFORE:

Using `mockSelector.setResult(undefined)` resulted in clearing the
return value.

AFTER:

Using `mockSelector.setResult(undefined)` will set the return value of
the selector to `undefined`.
To reset the mock selector, use `mockSelector.clearResult()`.
@ngrxbot
Copy link
Collaborator

ngrxbot commented Nov 18, 2019

Preview docs changes for 84e99c3 at https://previews.ngrx.io/pr2270-84e99c3/

@Maximaximum
Copy link
Contributor

This would be extremely useful, looking forward for this to be merged in!

Copy link
Member

@alex-okrushko alex-okrushko left a comment

Choose a reason for hiding this comment

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

This would result in a large number of broken tests.

@brandonroberts brandonroberts merged commit 803295b into master Jan 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mockstore selector override with undefined value
5 participants