Using MockStore in NgRx 8
summary
NgRx adds a testing API that replaces dispatching real actions with direct state and selector control: provideMockStore (v7) lets tests call setState to supply a base state, while v8 adds overrideSelector so tests return values for specific selectors without building full state. Tests assert that a component dispatches a loadCart action on init and that a text observable emits "loading" or the cart count when selectors return true/false. A scannedActions observable captures dispatched actions for verification.
AI-written summary Β· about
chapters (8)
- 0:00Introduction to NgRx testing
- 1:47Testing strategies
- 4:00Drawbacks of NgRx v6 testing
- 6:17Testing with MockStore
- 12:11Using Mock Selectors
- 16:12Verifying dispatched actions
- 18:31Testing store-dependent effects
- 22:33NgRx v8 updates and conclusion
related talks
37mTesting with MockStore in NgRx 9
20mTesting NgRX
01h 04mRedux for Angular -- Introduction to Ngrx Ecosystem
15mTesting a Redux store
44mAngular + Redux ... stop, what?
18mNgRx SignalStore: Modern State Management for Angular
34mReactive State Management For Your Angular App
22mState Management Techniques and Family Therapy
