/** * @copyright Sister Software * @license AGPL-3.0 * @author Teffen Ellis, et al. * * The corpus adapter-test harness — the sibling of `mailwoman/test-kit/`, and the shape every * `corpus/src/adapters/*\/adapter.test.ts` had grown for itself. * * Nine of them opened with the same twenty lines: the `mkdtemp`/`rm`/`tmpdir`/`join` + * `JSONSpliterator` import header, a `let scratch`, a `beforeEach` that mkdtemps * `mailwoman--`, an `afterEach` that force-removes it swallowing errors, and a * `loadRows()` that reads the run's `canonical.jsonl` back through `JSONSpliterator`. Nothing about * any of that is adapter-specific; only the tmpdir prefix and the adapter id ever differed. * * This directory is excluded from the published tarball by `corpus/package.json`'s `files` (the * `!test-kit/**\/*` entry, which predates this file), which is why importing `vitest` here is safe * — `mailwoman/test-kit/index.ts` imports it on the same grounds. */ import type { CanonicalRow } from "#types"; /** * A per-test scratch directory. `path` is only meaningful inside a test body — it is `""` until the `beforeEach` runs. */ export interface ScratchDir { readonly path: string; } /** * Register a fresh scratch directory for each test in the current suite, removed afterwards. * * `slug` names the directory (`mailwoman--XXXXXX` under the OS temp dir) and exists only to make a stray leftover * traceable to the suite that made it. Teardown swallows its own errors: a test that already removed the directory, or * a platform that holds a handle open, must not turn a passing assertion into a failing suite. */ export declare function useScratchDir(slug: string): ScratchDir; /** * Read back the canonical rows a `runAdapter` call wrote — `//canonical.jsonl`, streamed through * `JSONSpliterator` and collected. */ export declare function readCanonicalRows(outputDir: string, adapterID: string): Promise; /** * Write a delimited fixture — a header line plus the given rows — and answer its path. * * Three adapter suites carried a hand-rolled copy of this, and the copies disagreed about the one thing a reader cannot * see: two joined the rows without a trailing newline and the third appended one. `createNewlineWriter` terminates * every line it writes, so the file round-trips through `CSVSpliterator` the same way whichever suite produced it, and * a caller passes content without a delimiter. */ export declare function writeDelimitedFixture(filePath: string, header: string, rows: readonly string[]): Promise; //# sourceMappingURL=index.d.ts.map