How can an ngrx feature selector be unit tested in Jasmine with Angular 6?

I had the same problem and this thread helped me. Although the solution is not clear.

You need to use the projector function from the selector as @J-man said. For your case would be:

expect(selectors.getOldProducts.projector(state.oldProducts)).toBe(state.oldProducts);


Because the feature selector is selecting products from the store state, you'll have to create the global state.

const state = {
  products: {
    name: 'Product1',
    oldProduct: {
      price: 45.00
    },
    newProduct: {
      price: 50.00
    }
  }
}