Which @ngrx/* package(s) are the source of the bug?
effects
Minimal reproduction of the bug/regression with instructions
Hey, we are currently facing the problem that in one of our effect test files multiple tests are randomly failing because a selector returns undefined. We have mocked the selector value with the initialState property in the provideMockStore config. We have triple checked if the mocked data is fine and it is. Still we are receiving randomly an undefined value.
In a different effect spec file, we have basically the same tests. The setup for both effects is nearly identical, listen on actions, get some data from the state (the same as above mostly) and fetch some data. But these tests never randomly failed, even though it uses the same selectors. Here we have used a mocking solution with provideMockStoreselectors where we directly mock the used selectors.
Which @ngrx/* package(s) are the source of the bug?
effects
Minimal reproduction of the bug/regression with instructions
Hey, we are currently facing the problem that in one of our effect test files multiple tests are randomly failing because a selector returns
undefined
. We have mocked the selector value with theinitialState
property in theprovideMockStore
config. We have triple checked if the mocked data is fine and it is. Still we are receiving randomly anundefined
value.In a different effect spec file, we have basically the same tests. The setup for both effects is nearly identical, listen on actions, get some data from the state (the same as above mostly) and fetch some data. But these tests never randomly failed, even though it uses the same selectors. Here we have used a mocking solution with
provideMockStore
selectors
where we directly mock the used selectors.Example of failing spec file:
Example of always succeeding spec file:
Relevant selectors
We don't use any
overrideSelector
on the selector causing the problems in any of the tests.Expected behavior
We expect that if we use the
initialState
property and correctly mock the state, that the selectors will emit the expected values inside the tests.Or is there any reason that
initialState
shouldn't be use in this case?Versions of NgRx, Angular, Node, affected browser(s) and operating system(s)
Ngrx: 18.1.0 Angular: 18.1.4 Node: 20.15.1 Browser: Chrome OS: macOS 15.0.1
Other information
No response
I would be willing to submit a PR to fix this issue