Angular 使用热态和冷态的茉莉花大理石的计时/框架问题
我有一个大家可以在这里下载的快速演示:只需点击右上角的export,在您最喜欢的终端上,用您最喜欢的浏览器运行Angular 使用热态和冷态的茉莉花大理石的计时/框架问题,angular,jasmine,jasmine-marbles,Angular,Jasmine,Jasmine Marbles,我有一个大家可以在这里下载的快速演示:只需点击右上角的export,在您最喜欢的终端上,用您最喜欢的浏览器运行install和ng test 基本上,对我来说,问题似乎是茉莉花的内部计时与对象不匹配 下面是测试以及我得到的确切错误。有关完整的测试类,请参见app/Test下的示例 it('should return a GET_GENERIC_FAILED when the services throws', () => { const action = new genericAc
install
和ng test
基本上,对我来说,问题似乎是茉莉花的内部计时与对象不匹配
下面是测试以及我得到的确切错误。有关完整的测试类,请参见app/Test下的示例
it('should return a GET_GENERIC_FAILED when the services throws', () => {
const action = new genericActions.GetAllGenericAction();
genericsService.getAllGenerics.and.returnValue(Observable.throw({}));
actions$.stream = hot('a', { a: action });
const expected = cold('b', { b: new genericActions.GetGenericFailedAction() });
expect(effects.getAllGenerics).toBeObservable(expected);
});
错误呢
Expected
[Object({
frame: 0,
notification: Notification({
kind: 'N',
value: GetGenericFailedAction({
type: '[GENERIC] Get Generic Failed'
}),
error: undefined,
hasValue: true
})
}), Object({
frame: 0,
notification: Notification({
kind: 'C',
value: undefined,
error: undefined,
hasValue: false
})
})]
to equal
[Object({
frame: 0,
notification: Notification({
kind: 'N',
value: GetGenericFailedAction({
type: '[GENERIC] Get Generic Failed'
}),
error: undefined,
hasValue: true
})
})].
如果您能提供任何指导,我们将不胜感激。这似乎是一个关于如何抛出错误的问题 修复方法是添加
|
,将可观察到的标记为已完成,并将预期可观察到的标记包装在()
中,以将操作分组在一起
actions$.stream = hot('a|', { a|: action });
const expected = cold('(b|)', { b: new genericActions.GetGenericFailedAction() });
但是,对于内部维护人员来说,语法文档似乎更容易理解。我在测试中胡乱摆弄我的大理石图,这个
(b |)
部分实际上在我的案例中起了作用。但仍然对这些图表感到困惑。