mirror of
https://github.com/merlinhu1/truthmark.git
synced 2026-08-25 07:53:25 +02:00
* feat: add interactive platform selection to init * chore: remove completed OpenSpec artifacts * chore: remove implemented design note * fix: protect init lifecycle from unsafe config paths * fix: support clearing init platforms from CLI * docs: retire config command from repository rules * docs: align init lifecycle and clear-platform contracts * docs: keep repository guidance current-state focused * docs: limit cleanup to repository-native documents * docs: preserve historical version notes --------- Co-authored-by: MerlinH <merlinh221@gmail.com>
62 lines
2.1 KiB
TypeScript
62 lines
2.1 KiB
TypeScript
import { afterEach, describe, it } from "node:test";
|
|
import { expect } from "expect";
|
|
|
|
import { runCheck } from "../../src/checks/check.js";
|
|
import { writeTruthmarkConfig } from "../helpers/truthmark-config.js";
|
|
import { runInit } from "../../src/init/init.js";
|
|
import { createTempRepo, type TempRepo } from "../helpers/temp-repo.js";
|
|
|
|
describe("freshness diagnostics", () => {
|
|
const repos: TempRepo[] = [];
|
|
|
|
afterEach(async () => {
|
|
await Promise.all(repos.splice(0).map((repo) => repo.cleanup()));
|
|
});
|
|
|
|
it("reports changed code with no routed truth document when a base ref is supplied", async () => {
|
|
const repo = await createTempRepo();
|
|
repos.push(repo);
|
|
await repo.writeFile("scripts/unmapped.ts", "export const value = 1;\n");
|
|
await writeTruthmarkConfig(repo.rootDir);
|
|
await runInit(repo.rootDir);
|
|
await repo.runGit(["add", "."]);
|
|
await repo.runGit(["commit", "-m", "initial"]);
|
|
await repo.writeFile("scripts/unmapped.ts", "export const value = 2;\n");
|
|
|
|
const result = await runCheck(repo.rootDir, { base: "main" });
|
|
|
|
expect(result.diagnostics).toContainEqual(
|
|
expect.objectContaining({
|
|
category: "freshness",
|
|
severity: "review",
|
|
file: "scripts/unmapped.ts",
|
|
}),
|
|
);
|
|
});
|
|
|
|
it("does not report TypeScript public-symbol freshness when routed code changes", async () => {
|
|
const repo = await createTempRepo();
|
|
repos.push(repo);
|
|
|
|
await repo.writeFile("src/index.ts", "export const value = 1;\n");
|
|
await writeTruthmarkConfig(repo.rootDir);
|
|
await runInit(repo.rootDir);
|
|
await repo.runGit(["add", "."]);
|
|
await repo.runGit(["commit", "-m", "initial"]);
|
|
await repo.writeFile("src/index.ts", "export const changedValue = 2;\n");
|
|
|
|
const result = await runCheck(repo.rootDir, { base: "main" });
|
|
|
|
expect(result.diagnostics).not.toContainEqual(
|
|
expect.objectContaining({
|
|
category: "freshness",
|
|
severity: "review",
|
|
file: "src/index.ts",
|
|
message: expect.stringContaining(
|
|
"affected truth docs but none were changed",
|
|
),
|
|
}),
|
|
);
|
|
});
|
|
});
|