我想合并两个相同来源的地图,以保证结果的顺序。下面是我想一个单元测试通过:如何订购流合并?
const source = xs.of(1,2,3)
const a = source.map(v=>v*10)
const b = source.map(v=>v*100)
const hist:number[] = []
xs.merge(a,b).addListener({
next: v=>hist.push(v),
})
expect(hist).toEqual([10,100,20,200,30,300])
目前我得到的结果是这样的:
Expected value to equal:
[10, 100, 20, 200, 30, 300]
Received:
[10, 20, 30, 100, 200, 300]
可否请您发布jsbin?然后,它会更容易实验。 – user3743222