import { describe, expect, it } from "vitest"; import { createLlmAuditSummary, hashContent } from "../audit"; describe("LLM audit summary", () => { it("hashes content deterministically", async () => { await expect(hashContent("abc")).resolves.toBe( "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad", ); }); it("does not retain raw prompt or response", async () => { const summary = await createLlmAuditSummary({ provider: "deepseek", model: "deepseek-v4-pro", task: "renwei_copy_optimizer", duration_ms: 12, schema_valid: true, prompt: "完整 prompt 不应长期保存", output: "完整 response 不应长期保存", error_summary: null, }); expect(summary).toMatchObject({ provider: "deepseek", model: "deepseek-v4-pro", task: "renwei_copy_optimizer", duration_ms: 12, schema_valid: true, error_summary: null, }); expect(JSON.stringify(summary)).not.toContain("完整 prompt"); expect(JSON.stringify(summary)).not.toContain("完整 response"); expect(summary.input_hash).toHaveLength(64); expect(summary.output_hash).toHaveLength(64); }); });