Skip to content

Commit

Permalink
adding tests for concurrencyFork
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaly-t committed Aug 2, 2023
1 parent ace997d commit bfe077d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion test/ops/concurrency-fork/async.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}));

Check failure on line 12 in test/ops/concurrency-fork/async.ts

View workflow job for this annotation

GitHub Actions / Linting Checks

Replace `_async(input),·concurrencyFork({onAsync:·123·as·any})` with `⏎············_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(
Expand Down
7 changes: 6 additions & 1 deletion test/ops/concurrency-fork/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit bfe077d

Please sign in to comment.