I wrote the tests without the TestBed as advised by Viktor Savkin in this example repo. If you feel that the tests should use TestBed I can refactor it without a problem.
I refactored the retrieveStock effect into a function, which allows for easier overrides of the debounceTime value and scheduler during testing. It follows the official effects testing guide.
Finally, I fixed a bug with distinctUntilChanged() operator. Let me demonstrate it with the example:
By default distinctUntilChanged() uses === operator for equality check. Because every action is a new object, the operator will not filter anything, even though the actions have the exact same payload structure.
Luckily, distinctUntilChanged() accepts a compare function as an argument and we can just compare the symbol to get the desired behavior.
I wrote the tests without the TestBed as advised by Viktor Savkin in this example repo. If you feel that the tests should use TestBed I can refactor it without a problem.
I refactored the
retrieveStock
effect into a function, which allows for easier overrides of the debounceTime value and scheduler during testing. It follows the official effects testing guide.Finally, I fixed a bug with
distinctUntilChanged()
operator. Let me demonstrate it with the example:Assuming we dispatch the following actions:
By default
distinctUntilChanged()
uses === operator for equality check. Because every action is a new object, the operator will not filter anything, even though the actions have the exact same payload structure.Luckily,
distinctUntilChanged()
accepts a compare function as an argument and we can just compare the symbol to get the desired behavior.