Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/Aquaticat/Monochromatic. TypeScript and Rust monorepo: Claude Code and Pi coding-agent plugins, a m
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465/** Deterministic bounded asynchronous mapping tests. @module */import { wait, } from '@monochromatic-dev/module-async-time/ts';import { describe, expect, it,} from '@monochromatic-dev/module-test/ts';import { mapBounded, } from './map-bounded.ts';
await describe({ name: mapBounded.name, children: [ it({ name: 'rejects nonpositive concurrency', fails: true, fn: async function testInvalidConcurrency() { await mapBounded({ values: ['value',], concurrency: 0, map: async function identity({ value, }) { return value; }, },); }, },), it({ name: 'returns empty output without invoking mapper', fn: async function testEmptyInput() { expect(await mapBounded({ values: [], concurrency: 1, map: function rejectUnexpectedMapper(): Promise<never> { return Promise.reject(new Error('Empty bounded map invoked mapper.',),); }, },),).toEqual([],); }, },), it({ name: 'preserves input order across concurrent lanes', fn: async function testStableOrder() { expect(await mapBounded({ values: [ 2, 0, 1, ], concurrency: 2, map: async function delayedValue({ value, }) { await wait(value,); return String(value,); }, },),).toEqual([ '2', '0', '1', ],); }, },), ],},);