且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在单元测试期间,Observable.fromPromise为空

更新时间:2023-02-14 17:36:21

这有点不幸,但没有很好的方式来兑现承诺在Rx v5中,在TestScheduler的上下文中同步解析。由于这些原因,如果Observable源从promise开始,它将不适用于大理石测试并且您必须通过订阅以不同方式创建断言。

It is bit unfortunate but there wasn't great way to make promise resolves synchronously under context of TestScheduler in Rx v5. For those reason, if Observable source started off from promise it won't work with marble testings and you have to create assertion differently by subscribing.

检查 https://github.com / ReactiveX / rxjs / issues / 701 / https://github.com/ReactiveX/ rxjs / pull / 745 如果你想详细说明为什么它没有成功。

Check https://github.com/ReactiveX/rxjs/issues/701 / https://github.com/ReactiveX/rxjs/pull/745 if you'd like to have detail why it wasn't successful.