mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-05 16:34:00 +01:00
test(diagram-render): name the bundle, BUILD_INFO and build script by repo path so the pre-gate sees their lane
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
8f2b3873cd
commit
df3431f914
1 file changed
+8
-4
@@ -17,9 +17,13 @@ import { createHash } from "node:crypto";
|
||||
import { existsSync } from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
const ROOT = path.resolve(import.meta.dir, "..", "lib", "diagram-render");
|
||||
const DIST_HTML = path.join(ROOT, "dist", "diagram-render.html");
|
||||
const BUILD_INFO = path.join(ROOT, "dist", "BUILD_INFO.json");
|
||||
// Repo-relative segment runs, so the pre-gate's import graph sees that this
|
||||
// test owns the committed bundle, its BUILD_INFO and the build script.
|
||||
const REPO = path.resolve(import.meta.dir, "..");
|
||||
const ROOT = path.join(REPO, "lib", "diagram-render");
|
||||
const DIST_HTML = path.join(REPO, "lib", "diagram-render", "dist", "diagram-render.html");
|
||||
const BUILD_INFO = path.join(REPO, "lib", "diagram-render", "dist", "BUILD_INFO.json");
|
||||
const BUILD_SCRIPT = path.join(REPO, "lib", "diagram-render", "scripts", "build.ts");
|
||||
|
||||
describe("diagram-render bundle drift", () => {
|
||||
test("dist hash matches BUILD_INFO (tamper check)", async () => {
|
||||
@@ -43,7 +47,7 @@ describe("diagram-render bundle drift", () => {
|
||||
const info = await Bun.file(BUILD_INFO).json();
|
||||
const srcSha = createHash("sha256")
|
||||
.update(await Bun.file(path.join(ROOT, "src", "entry.ts")).text())
|
||||
.update(await Bun.file(path.join(ROOT, "scripts", "build.ts")).text())
|
||||
.update(await Bun.file(BUILD_SCRIPT).text())
|
||||
.digest("hex");
|
||||
expect(srcSha).toBe(info.srcSha256);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user