From bfe077dd8ddc64945a10b0c92a03b8356286f9cd Mon Sep 17 00:00:00 2001 From: Vitaly Tomilov Date: Wed, 2 Aug 2023 07:56:54 +0100 Subject: [PATCH] adding tests for concurrencyFork --- test/ops/concurrency-fork/async.ts | 7 ++++++- test/ops/concurrency-fork/sync.ts | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/test/ops/concurrency-fork/async.ts b/test/ops/concurrency-fork/async.ts index 15acf775..8482b89e 100644 --- a/test/ops/concurrency-fork/async.ts +++ b/test/ops/concurrency-fork/async.ts @@ -2,11 +2,16 @@ import {_async, _asyncValues, expect} from '../../header'; import {pipe, concurrencyFork} from '../../../src'; export default () => { - it('must default to the source', async () => { + it('must default to the source on missing handlers', async () => { const input = [1, 2, 3]; const output = pipe(_async(input), concurrencyFork({})); expect(await _asyncValues(output)).to.eql(input); }); + it('must default to the source on invalid handlers', async () => { + const input = [1, 2, 3]; + const output = pipe(_async(input), concurrencyFork({onAsync: 123 as any})); + expect(await _asyncValues(output)).to.eql(input); + }); it('must return the result', async () => { const input = [1, 2, 3]; const output = pipe( diff --git a/test/ops/concurrency-fork/sync.ts b/test/ops/concurrency-fork/sync.ts index d2464821..2f458190 100644 --- a/test/ops/concurrency-fork/sync.ts +++ b/test/ops/concurrency-fork/sync.ts @@ -2,11 +2,16 @@ import {expect} from '../../header'; import {pipe, concurrencyFork} from '../../../src'; export default () => { - it('must default to the source', () => { + it('must default to the source on missing handlers', () => { const input = [1, 2, 3]; const output = pipe(input, concurrencyFork({})); expect([...output]).to.eql(input); }); + it('must default to the source on invalid handlers', () => { + const input = [1, 2, 3]; + const output = pipe(input, concurrencyFork({onSync: 123 as any})); + expect([...output]).to.eql(input); + }); it('must return the result', () => { const input = [1, 2, 3]; const output = pipe(