import { PathBuilder, type PathBuilderLike } from "path-ts"; import type { ParquetRow } from "#parquet/schema"; import type { CanonicalRow } from "#types"; /** * A per-test scratch directory. * * `path` exists only inside a test body. * A read before `beforeEach` or after `afterEach` throws. */ export interface ScratchDir { readonly path: PathBuilder; } /** * 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) * so a stray leftover is traceable to its suite. * Teardown swallows its own errors, because a test that already removed the directory * or a platform holding a handle open mustn't turn a passing assertion into a failing suite. */ export declare function useScratchDir(slug: string): ScratchDir; /** * Read back the canonical rows a `runAdapter` call wrote at `//canonical.jsonl`. */ export declare function readCanonicalRows(outputDir: PathBuilderLike, adapterID: string): Promise; /** * Write a delimited fixture (a header line plus the given rows) and answer its path; * `createNewlineWriter` terminates every line, so a caller passes content without a delimiter. */ export declare function writeDelimitedFixture

(filePath: P, header: string, rows: readonly string[]): Promise

; /** * Whether a test that calls a publisher's live service should run. * * CI's `unit-slow` leg runs every `*.integration.test.ts`, and the required * `test` context fails when that leg does. * A test calling a foreign government host therefore makes a merge depend on that host's * availability: Poland's address service answered `ECONNRESET` mid-run on 2026-10-02 * and reddened a local preflight that had passed an hour earlier. * * So a live-service test is opt-in, and the suite reports it as skipped * rather than passing on a check it didn't make. * Run one with `MAILWOMAN_LIVE_PUBLISHER_TESTS=1 yarn vitest --run --config vitest.slow.config.ts `. * * A test reading a committed fixture needs this switch unset, and most of * each harvester's coverage is there. * The switch is for the assertions only the publisher can answer: that a URL still serves, * that a feed still states what the register recorded, that a harvest the adapter can read comes back. * * It reads `process.env` directly, because it is a per-run test switch rather than * project configuration and so has no entry in `@mailwoman/core/env`. */ export declare const LIVE_PUBLISHER_TESTS: boolean; /** * Whether a {@linkcode ReferenceFixture} records the values it is given instead of asserting them. * * Set `MAILWOMAN_REFREEZE_FIXTURES=1` for one run after a change that moves a builder's output * on purpose, such as a new generator, then read the fixture's diff before committing it. * Like the switch above, it reads `process.env` directly. */ export declare const REFREEZE_FIXTURES: boolean; /** * A committed reference a builder test compares its output against, field by field. * * Each {@linkcode ReferenceFixture.expect} asserts one field. * Under {@linkcode REFREEZE_FIXTURES} it records the actual value instead, * and {@linkcode ReferenceFixture.save} writes the fixture with every recorded field. */ export declare class ReferenceFixture { readonly path: string; readonly values: T; constructor(path: string, values: T); static read(path: PathBuilderLike): Promise>; /** * Asserts that `actual` equals the field, or records it under a re-freeze. */ expect(field: keyof T & string, actual: unknown): void; /** * {@linkcode expectReportBytes} against the field, or records it under a re-freeze. */ expectReport(field: keyof T & string, actual: unknown): void; /** * Writes the fixture under a re-freeze, and leaves it unchanged otherwise. */ save(): Promise; } /** * The NAD adapter's fixture records, one JSON object per line. */ export declare const NAD_FIXTURE: "mailwoman/corpus/lib/us/adapters/usgov/nad/fixtures/fixture.ndjson"; /** * Writes `records` as NAD release text with every column the adapter reads into `dir`, * and converts it to `NAD_test.parquet` there the way the fetcher does. * * Without `records`, it writes {@linkcode NAD_FIXTURE}'s. */ export declare function writeNADReleaseParquet(dir: PathBuilder, records?: ReadonlyArray>): Promise; /** * One GB parquet row whose postcode sits at the end of `raw`, the shape `rendered-gb-os-open` renders. * * The streets and postcodes come from OS OpenData (OGL v3.0), not from HM Land Registry Price Paid Data. * * The span triple is what the holdout splitter reads, so the offsets name the real substring: * a fixture whose spans pointed elsewhere would pass against a splitter reading the wrong column. */ export declare function gbOverlayRow(sourceID: string, street: string, locality: string, postcode: string): ParquetRow; /** * Asserts the invariants of every span-labeled row a corpus builder writes: * `0 <= start < end <= length` in code points, each span beginning and ending on a * non-whitespace character, and starts in ascending order. * * A builder's own record check allows whitespace inside a CJK span, so the edge rule is checked here. */ export declare function expectSpanInvariants(rows: readonly unknown[]): void; /** * Asserts that a parsed build report matches its reference in every value and every key's position. * * The byte comparison checks key order. * `toEqual` ignores key order. * * The comparison sorts the tags that tie within each `per_tag_rows` count on both sides first, * because the Python reference counted tags from a set and its tie order followed `PYTHONHASHSEED`. */ export declare function expectReportBytes(report: unknown, reference: unknown): void; //# sourceMappingURL=test-kit.d.ts.map