我有一个返回动作 A 然后是动作 B 的效果
@Effect() myEffect$: Observable <Action> = this.actions$
.ofType('MY_ACTION')
.switchMap(() => Observable.of(
// subscribers will be notified
{ type: 'ACTION_ONE' },
// subscribers will be notified (again ...)
{ type: 'ACTION_TWO' }
));
如何测试两个连续返回的操作?
it('should return action one then action two', () => {
runner.queue(new myAction());
const expectedResult = twoSuccesiveActions;
sessionEffect.myEffect$.subscribe(result => {
// how do I test those two succesively returned actions
expect(result).toEqual(expectedResult);
});
});