Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
@@ -2,12 +2,14 @@ import { execFile } from "node:child_process";
|
||||
import { mkdtemp, mkdir, writeFile } from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { createRequire } from "node:module";
|
||||
import { promisify } from "node:util";
|
||||
import { describe, expect, test } from "vitest";
|
||||
|
||||
import { renderApiInventoryGuardResult, validateApiInventory } from "./check-api-inventory.js";
|
||||
|
||||
const execFileAsync = promisify(execFile);
|
||||
const tsxCli = createRequire(import.meta.url).resolve("tsx/cli");
|
||||
|
||||
async function makeFixture() {
|
||||
const root = await mkdtemp(path.join(os.tmpdir(), "api-inventory-"));
|
||||
@@ -43,6 +45,25 @@ describe("api inventory guard", () => {
|
||||
expect(output).not.toContain("SECRET_TOKEN_SHOULD_NOT_PRINT");
|
||||
});
|
||||
|
||||
test("permanently blocks the removed AD-26 AI upload route", async () => {
|
||||
const fixture = await makeFixture();
|
||||
await writeFile(
|
||||
fixture.appSourcePath,
|
||||
'import { Hono } from "hono";\nconst app = new Hono();\napp.post("/v1/ai/upload", () => "must-stay-removed");\n',
|
||||
"utf8",
|
||||
);
|
||||
|
||||
const result = await validateApiInventory({ appSourcePath: fixture.appSourcePath, removedWebApiRoutesRoot: fixture.removedWebApiRoutesRoot });
|
||||
|
||||
expect(result.ok).toBe(false);
|
||||
expect(result.violations).toContainEqual(
|
||||
expect.objectContaining({
|
||||
routeKey: "POST /v1/ai/upload",
|
||||
surface: "hono",
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
test("fails when removed React Router API route files are present", async () => {
|
||||
const fixture = await makeFixture();
|
||||
await mkdir(path.join(fixture.removedWebApiRoutesRoot, "auth"), { recursive: true });
|
||||
@@ -84,7 +105,7 @@ describe("api inventory guard", () => {
|
||||
});
|
||||
|
||||
test("CLI fails on unknown flags", async () => {
|
||||
await expect(execFileAsync("pnpm", ["exec", "tsx", "scripts/check-api-inventory.ts", "--unknown"])).rejects.toMatchObject({
|
||||
await expect(execFileAsync(process.execPath, [tsxCli, "scripts/check-api-inventory.ts", "--unknown"])).rejects.toMatchObject({
|
||||
code: 1,
|
||||
stderr: expect.stringContaining("FAIL api-inventory: unknown arguments"),
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user