Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | import type { SampleParams, SampleResult } from '../types.ts';
/**
* Returns a sample function that returns a sequence of result texts (one per call).
*
* @param responses - Text strings to return, in order, for each call.
* @returns A function matching the sample service signature.
*/
export const makeMockSample = (
responses: string[],
): ((params: SampleParams) => Promise<SampleResult>) => {
let idx = 0;
return async (_params) => {
const text = responses[idx] ?? '';
idx += 1;
return harden({ text });
};
};
|