Files
Moltbot/src/shared/assistant-identity-values.test.ts
2026-03-13 20:24:35 +00:00

18 lines
667 B
TypeScript

import { describe, expect, it } from "vitest";
import { coerceIdentityValue } from "./assistant-identity-values.js";
describe("shared/assistant-identity-values", () => {
it("returns undefined for missing or blank values", () => {
expect(coerceIdentityValue(undefined, 10)).toBeUndefined();
expect(coerceIdentityValue(" ", 10)).toBeUndefined();
});
it("trims values and preserves strings within the limit", () => {
expect(coerceIdentityValue(" OpenClaw ", 20)).toBe("OpenClaw");
});
it("truncates overlong trimmed values at the exact limit", () => {
expect(coerceIdentityValue(" OpenClaw Assistant ", 8)).toBe("OpenClaw");
});
});