mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 23:40:45 +00:00
19 lines
625 B
TypeScript
19 lines
625 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { maskApiKey } from "./mask-api-key.js";
|
|
|
|
describe("maskApiKey", () => {
|
|
it("returns missing for empty values", () => {
|
|
expect(maskApiKey("")).toBe("missing");
|
|
expect(maskApiKey(" ")).toBe("missing");
|
|
});
|
|
|
|
it("returns trimmed value when length is 16 chars or less", () => {
|
|
expect(maskApiKey(" abcdefghijklmnop ")).toBe("abcdefghijklmnop");
|
|
expect(maskApiKey(" short ")).toBe("short");
|
|
});
|
|
|
|
it("masks long values with first and last 8 chars", () => {
|
|
expect(maskApiKey("1234567890abcdefghijklmnop")).toBe("12345678...ijklmnop");
|
|
});
|
|
});
|