【发布时间】:2018-06-27 08:04:52
【问题描述】:
ngrx 和单元测试初学者在这里。我有以下效果:
@Injectable()
export class NotificationEffects {
@Effect({dispatch: false})
notificationShow$ = this.actions$
.ofType(notificationAction.NOTIFICATION_SHOW)
.do((action: notificationAction.NotificationShowAction) => {
this.notificationService.info(action.payload.config);
});
constructor(private actions$: Actions, private notificationService: NotificationService) {}
}
具体来说,我想测试一下notificationService方法info是否被调用了。我该怎么做?
我遵循了这些示例,但没有找到解决方案:
https://netbasal.com/unit-test-your-ngrx-effects-in-angular-1bf2142dd459 https://medium.com/@adrianfaciu/testing-ngrx-effects-3682cb5d760e https://github.com/ngrx/effects/blob/master/docs/testing.md
【问题讨论】:
标签: angular unit-testing ngrx-effects