import { readFile } from "node:fs/promises"; import { describe, expect, it } from "vitest"; describe("Go legacy auth compatibility HTTP v1 contract", () => { it("pins login, callback, and disabled captcha endpoints", async () => { const fixture = JSON.parse(await readFile(new URL("../contracts/admin/http-auth-compat-v1.json", import.meta.url), "utf8")); const source = await readFile(new URL("../backend/internal/httpapi/auth_compat.go", import.meta.url), "utf8"); expect(fixture.routes.map((route: { path: string }) => route.path)).toEqual(["/api/auth/login", "/api/auth/callback", "/api/auth/captcha"]); expect(source).toContain("callback_failed"); expect(source).toContain("平台账号登录不使用外部验证码。"); }); });