Testing Selectors
Learn how to unit test the NgRx selectors.
Introduction
In our application’s Products
module, we have defined the getProductsSelector
in the src/app/products/state/products.selectors.ts
file. This selector retrieves the entire products
slice from the NgRx store.
import { createFeatureSelector } from "@ngrx/store";import { ProductsState } from "./products.interfaces";export const getProductsSelector = createFeatureSelector<ProductsState>('products');
Selectors defined in the Products module
In this lesson, let’s write a test case to verify that our getProductsSelector
is properly retrieving the products
slice.
Unit testing the NgRx selectors
We can unit test the NgRx ...