Files
suaveplan/packages/foundation/flow/idempotency/tests/benchmarks-present.spec-conformance.test.ts
2026-05-27 23:47:53 +01:00

36 lines
1.1 KiB
TypeScript

/**
* Spec-conformance pinning test for IDMP-07 — Benchmarks with mitata.
* Verifies that the benchmark suite exists at the canonical location and
* exercises the four required hot paths.
*/
import { existsSync, readFileSync } from "node:fs";
import { resolve } from "node:path";
import { describe, expect, it } from "@suaveplan/testing/runner";
const BENCH_PATH = resolve(
import.meta.dirname,
"..",
"src",
"__benchmarks__",
"idempotency.bench.ts"
);
describe("benchmark suite [spec-conformance IDMP-07]", () => {
it("benchmark file exists at src/__benchmarks__/idempotency.bench.ts", {
timeout: 5000,
}, () => {
expect(existsSync(BENCH_PATH)).toBe(true);
});
it("benchmark file references the four required hot paths", {
timeout: 5000,
}, () => {
const content = readFileSync(BENCH_PATH, "utf8");
expect(content).toMatch(/MemoryIdempotencyStore/);
expect(content).toMatch(/IdempotencyGuard/);
expect(content).toMatch(/compositeKey/);
expect(content).toMatch(/fingerprintPayload/);
});
});