【发布时间】:2025-12-17 17:15:01
【问题描述】:
如果我一次为一个史诗运行所有测试,则只有第一个测试通过。其他测试失败,因为框架不同。但是每个测试都单独运行通过。
我在 RxJS 中找不到任何与此下界相关的问题,而不是 redux 可观察文档。
我认为TestScheduler 上可能有某种重置功能,但没有。
我的一个测试(它们看起来都很相似):
test('should fail if e-mail is missing', () => {
testScheduler.run(({ hot, expectObservable }) => {
const action$ = new ActionsObservable(
hot('-a', {
a: login('', 'secret')
})
);
const output$ = epic(action$, null, null);
expectObservable(output$).toBe('-a', {
a: failure(
formErrors.credentialsEmpty(['email', 'password'])
)
});
});
});
我希望输出弹珠的框架是 1,但它是 2。 失败测试的输出:
Array [
Object {
- "frame": 1,
+ "frame": 2,
"notification": Notification {
"error": undefined,
"hasValue": true,
"kind": "N",
"value": Object {
编辑
我可以通过为每个测试创建一个 TestScheduler 实例来解决该问题,但我不确定我是否应该这样做。
【问题讨论】:
标签: rxjs redux-observable rxjs-test-scheduler