16 lines
710 B
TypeScript
16 lines
710 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import { redactDiagnosticJsonString, redactDiagnosticText } from "./redaction";
|
|
|
|
describe("diagnostic redaction", () => {
|
|
it("redacts sensitive scalar diagnostics", () => {
|
|
expect(redactDiagnosticText("token=secret Authorization=Bearer abc123")).toBe("token=[REDACTED] Authorization=Bearer [REDACTED]");
|
|
});
|
|
|
|
it("redacts sensitive JSON keys before UI display or copy", () => {
|
|
expect(redactDiagnosticJsonString(JSON.stringify({ token: "secret", nested: { authorization: "Bearer abc123", kept: "value" } }))).toBe(
|
|
'{\n "token": "[REDACTED]",\n "nested": {\n "authorization": "[REDACTED]",\n "kept": "value"\n }\n}',
|
|
);
|
|
});
|
|
});
|