|
|
@@ -40,3 +40,7 @@ test('fifty concurrent consumers remain bounded and a submission passes a read b
|
|
|
const write=firstValueFrom(s.schedule(()=>{order.push('write');return of('saved');},{read:false}));
|
|
|
assert.equal(await write,'saved');assert.equal(order[0],'write');assert.deepEqual(await Promise.all(reads),Array.from({length:50},(_,i)=>i));assert.ok(max<=3);assert.equal(s.snapshot().active,0);assert.equal(s.snapshot().queued,0);
|
|
|
});
|
|
|
+test('firstValueFrom success counts as completion rather than consumer cancellation',async()=>{
|
|
|
+ const s=scheduler(),response=new Subject();const pending=firstValueFrom(s.schedule(()=>response,{read:true}));response.next(1);assert.equal(await pending,1);
|
|
|
+ assert.equal(s.snapshot().completed,1);assert.equal(s.snapshot().cancelled,0);
|
|
|
+});
|