diff --git a/tests/public-surface-wording.test.ts b/tests/public-surface-wording.test.ts index 3c870d1..fab6951 100644 --- a/tests/public-surface-wording.test.ts +++ b/tests/public-surface-wording.test.ts @@ -5,13 +5,73 @@ import { describe, expect, it } from "vitest"; // Files that reach readers (the npm tarball, the README files and the changelog) must not // point at the private development notes this package was built from: links into the -// private repository, internal task and milestone labels, or section numbers of +// private repository, internal task, milestone and review labels, month-level stage names, +// the row numbers of the review table, design decision numbers, or section numbers of // unpublished documents. dist is generated from src, so src is what is checked. const packageRoot = fileURLToPath(new URL("..", import.meta.url)); +/** + * Internal references in the wording of the published files. + * + * Each alternative is kept narrow on purpose, so ordinary code and text (EPSG codes, + * `UTJCP:ZONE-B`, `metresPerUnit`, `UTF-8`, `ISO-8601`, `x-skew`) stay clean. The samples + * used by the tests below are the guard that the expression is neither too narrow nor too + * wide. + */ const INTERNAL_REFERENCE = - /docs\/superpowers|\bm[0-9]+[ab]?-t[0-9]+|Cycle 1|post-cycle|仮仕様|AC-m[0-9]|HR-m[0-9]|SR-m[0-9]|maplat-v4-crs-libs|provisional specification|§[0-9]/; + /docs\/superpowers|\bPR-T[0-9]+[A-Za-z]?|\btrain\/[0-9]{4}-[0-9]{2}|\b(?:MAJ|MIN)-[0-9]+|\b(?:Minor|Info)-[0-9]+|トレイン|照合表|第\s*[0-9]+\s*便|サイクル\s*[0-9]+|NayutaProducts|\bDSH\b|\bm[0-9]+[ab]?-t[0-9]+|\bCycle ?[0-9]|post-cycle|仮仕様|AC-m[0-9]|HR-m[0-9]|SR-m[0-9]|maplat-v4-crs-libs|provisional specification|(? { expect(files.length).toBeGreaterThan(0); }); + it("flags the internal references reviewers reported", () => { + for (const sample of MUST_MATCH) { + expect(INTERNAL_REFERENCE.test(sample), sample).toBe(true); + } + }); + + it("leaves ordinary code and text alone", () => { + for (const sample of MUST_NOT_MATCH) { + expect(INTERNAL_REFERENCE.test(sample), sample).toBe(false); + } + }); + it("has no internal reference in the published sources, README files and changelog", () => { const hits: string[] = []; for (const file of files) {