如何使用rxjs弹珠测试发出分组事件的可观测对象? [英] How to test observables which emit grouped events with rxjs marbles?

查看:128
本文介绍了如何使用rxjs弹珠测试发出分组事件的可观测对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据 rxjs大理石文档同步分组的当前行为如下:

According to rxjs marbles documentation the current behaviour for the sync groupings is the following:

'(ab)-(cd)': on frame 0, emits a and b then on frame 50, emits c and d

从文档中

虽然一开始可能很不直观,但是在所有值同步发出之后,将进行与该组中的ASCII字符数(包括括号)相等的帧数

While it can be unintuitive at first, after all the values have synchronously emitted time will progress a number of frames equal to the number of ASCII characters in the group, including the parentheses

好,但是如何测试这样的可观察物体(使用大理石或其他任何技术):

Ok, but how do I test an observable like this (using marbles or any other technique):

const observable$ = of(1, 2).concat(of(3, 4).delay(20));

有没有解决方法?

There is a similar question on Stack Overflow but there is no answer on 'How to actually work around it and test this kind of observable'.

谢谢!

推荐答案

对于我的项目,我迁移到 rx -sanbox ,其中同步分组有效,并且解决了我的问题.

For my project I migrated to rx-sanbox where sync grouping works correct and it solved my problem.

因此,在rx-sandbox中,这是正确的: '(ab)-(cd)': on frame 0, emits a and b then on frame 20, emits c and d

So, in rx-sandbox this is correct: '(ab)-(cd)': on frame 0, emits a and b then on frame 20, emits c and d

这篇关于如何使用rxjs弹珠测试发出分组事件的可观测对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆