ngrx-testing | Testing NgRx with jest and jasmine-marbles | Reactive Programming library
kandi X-RAY | ngrx-testing Summary
kandi X-RAY | ngrx-testing Summary
This project is based on a presentation given at the Rocky Mountain Angular meetup. Be sure to check out the NgRx Testing slide deck as well.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ngrx-testing
ngrx-testing Key Features
ngrx-testing Examples and Code Snippets
Community Discussions
Trending Discussions on ngrx-testing
QUESTION
I have an @Effect
that uses a MemoizedSelector
to grab an item from the redux store and mergeMap
it with the payload of an Action. The effect works just fine, however setting up the Jest tests for this has proven difficult as I cannot seem to mock the return value of the selector due to select
being a declared function that's imported (from '@ngrx/store') and used in the effect and the selector itself being an imported function as well. I'm grasping at straws now.
How can I write a Unit Test to test an NGRX effect that makes use of a store selector?
"@ngrx/store": "^7.4.0",
"rxjs": "^6.2.2"
- using
ANSWER
Answered 2019-May-14 at 06:33We got this covered in the ngrx.io docs. Note that the syntax is for NgRx 8 but the same ideas count for NgRx 7.
QUESTION
I'm adding unit testing to my angular/rxjs project, and I'm using the marble test
solution. And since I'm using the newer version of rxjs, so I used the build-in "TestScheduler" module.
I'm following this post: https://brianflove.com/2018/06/28/ngrx-testing-effects/, And it gave an example as following:
...ANSWER
Answered 2019-Oct-15 at 19:43I want to preface this by saying I'm not too familiar with ngrx, so this is just me guessing: It looks like everything is being passed into an action reducer. The action stream -a
is being tested with --b
, and you don't want your action reducer to end because you want it to be able to take in the next action.
QUESTION
On Mac, I am having problem getting jest installed and working in an angular/cli (v6) app. Regardless of the methods I used to place jest (listed below), I am getting error:
...ANSWER
Answered 2018-Oct-17 at 09:06Today I found same error message then this is my solution.
- clear jest caching by
jest --clearCache
- add
"module": "commonjs"
in tsconfig.spec.json
ref: https://github.com/thymikee/jest-preset-angular/issues/194
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ngrx-testing
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page