Files
openclaw/src/utils/string-readers.test.ts
Peter Steinberger 0dd9dcda2f refactor(auto-reply): normalize inbound text once (#113179)
* refactor(auto-reply): canonicalize inbound text once

* chore(plugin-sdk): refresh API baseline

* refactor(auto-reply): narrow finalized template context

* test(auto-reply): keep runner fixtures structurally compatible

* fix(auto-reply): guard optional post-command agent text

* fix(auto-reply): finalize intercepted gateway context

* fix(ci): register iOS release planner entries
2026-07-23 17:39:01 -07:00

29 lines
921 B
TypeScript

import { describe, expect, it } from "vitest";
import { isStringOption, readTrimmedStringAlias } from "./string-readers.js";
describe("string readers", () => {
it("checks caller-owned string options from arrays and sets", () => {
const modes = ["off", "auto"] as const;
const states = new Set(["ready", "done"] as const);
expect(isStringOption("auto", modes)).toBe(true);
expect(isStringOption(" AUTO ", modes)).toBe(false);
expect(isStringOption("done", states)).toBe(true);
expect(isStringOption(1, modes)).toBe(false);
});
it("reads trimmed aliases", () => {
const record = {
empty: "",
spaced: " value ",
fallback: "fallback",
invalid: 1,
};
expect(readTrimmedStringAlias(record, ["invalid", "empty", "spaced", "fallback"])).toBe(
"value",
);
expect(readTrimmedStringAlias(record, ["invalid", "empty"])).toBeUndefined();
});
});