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

docs(effects): rewrite testing #1974

Merged
merged 4 commits into from
Jul 15, 2019
Merged

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
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[x] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

Part of #1383

What is the new behavior?

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

@timdeschryver timdeschryver force-pushed the pr/docs-effects-testing branch from bf3b45c to 54da821 Compare June 26, 2019 19:30
@timdeschryver
Copy link
Member Author

Thanks for the feedback @itayod , I reworded some sentences in the last commit.

@timdeschryver timdeschryver force-pushed the pr/docs-effects-testing branch from 54da821 to 1cbf421 Compare June 26, 2019 19:38
@ngrxbot
Copy link
Collaborator

ngrxbot commented Jun 26, 2019

Preview docs changes for 54da821 at https://previews.ngrx.io/pr1974-54da821/

@itayod
Copy link
Contributor

itayod commented Jun 26, 2019

LGTM! 👍

@ngrxbot
Copy link
Collaborator

ngrxbot commented Jun 26, 2019

Preview docs changes for 1cbf421 at https://previews.ngrx.io/pr1974-1cbf421/

@yluijten
Copy link

yluijten commented Jul 5, 2019

@timdeschryver Is there also a full example of the (non-testbed) source code available?

// other providers
],
});
For a detailed look on the marble syntax, see [Writing marble tests](https://github.com/ReactiveX/rxjs/blob/master/doc/writing-marble-tests.md).
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
For a detailed look on the marble syntax, see [Writing marble tests](https://github.com/ReactiveX/rxjs/blob/master/doc/writing-marble-tests.md).
For a detailed look on the marble syntax, see [Writing marble tests](https://rxjs.dev/guide/testing/marble-testing).

)
);
// verify the navigation has been called
expect(router.navigateByUrl).toHaveBeenCalledWith('customers/bob');
Copy link
Member

Choose a reason for hiding this comment

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

This example should include spying on the router.navigateByUrl method


Leverage [`MockStore`](/guide/store/testing#using-a-mock-store) and [`MockSelectors`](/guide/store/testing#using-mock-selectors) to test Effects that are selecting slices of the state.

An example of this is to not fetch an entity (customer in this case) when it's already in the store state.
Copy link
Member

Choose a reason for hiding this comment

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

I think we still need to include an effects example that you are testing against here.

Copy link
Member Author

Choose a reason for hiding this comment

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

There's an example at https://ngrx.io/guide/effects#incorporating-state.
I didn't add any effects code in the testing guide, only how to test them.
If we add an effects example for this test, we should add them for the rest too.
Thoughts?

@brandonroberts brandonroberts added the Needs Cleanup Review changes needed label Jul 7, 2019
@ngrxbot
Copy link
Collaborator

ngrxbot commented Jul 8, 2019

Preview docs changes for f23c4ce at https://previews.ngrx.io/pr1974-f23c4ce/

Copy link
Member

@brandonroberts brandonroberts left a comment

Choose a reason for hiding this comment

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

LGTM. One minor change

Co-Authored-By: Brandon <robertsbt@gmail.com>
@ngrxbot
Copy link
Collaborator

ngrxbot commented Jul 15, 2019

Preview docs changes for 2d3c2fc at https://previews.ngrx.io/pr1974-2d3c2fc/

@brandonroberts brandonroberts removed the Needs Cleanup Review changes needed label Jul 15, 2019
@brandonroberts brandonroberts merged commit c00a9c2 into master Jul 15, 2019
@brandonroberts brandonroberts deleted the pr/docs-effects-testing branch July 15, 2019 17:27
@timdeschryver
Copy link
Member Author

@yluijten You can find examples at https://github.com/vsavkin/testing_ngrx_effects and https://github.com/tomastrajan/angular-ngrx-material-starter

jordanpowell88 pushed a commit to jordanpowell88/platform that referenced this pull request Nov 14, 2019
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.

5 participants