mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-02 07:01:34 +00:00
* refactor(normalization): consolidate string helpers * refactor(normalization): consolidate agent ids * refactor(paths): consolidate user path resolution * refactor(gateway): preserve transcript helper facade * fix(normalization): align helper build aliases * fix(memory): keep helper import line neutral * chore(plugin-sdk): align consolidated helper surface * refactor(normalization): reuse lowercase string helper * refactor(normalization): reuse record guard * refactor(normalization): share surrogate boundary helper * refactor(agents): share token estimate constant * refactor(memory): distinguish standalone helper contracts * refactor(normalization): share error cause formatter * refactor(config): distinguish eligibility predicates * refactor(plugins): share registry state symbol * refactor(cli): reuse outbound dependency adapter * refactor(cron): distinguish positive duration parser * fix(gateway): keep transcript helper private * fix(paths): preserve public helper status * refactor(channels): reuse registry normalizer * refactor(agents): reuse agent core runtime facade * refactor(auth): reuse locked profile upsert * refactor(records): distinguish trap-safe guard * refactor(migrations): distinguish sync directory helper * test(plugins): drop stale duration alias expectations * fix(channels): remove stale registry import * chore(plugin-sdk): refresh helper API baseline * fix(memory): keep renamed helpers private * fix(plugins): keep registry state key private * fix(plugin-sdk): tighten wildcard surface budget * chore(plugin-sdk): refresh rebased helper API baseline
25 lines
739 B
TypeScript
25 lines
739 B
TypeScript
import { isValidAgentId, normalizeAgentId } from "@openclaw/normalization-core/agent-id";
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
describe("normalization-core/agent-id", () => {
|
|
it.each([
|
|
[undefined, "main"],
|
|
[" OPS ", "ops"],
|
|
["Agent not found: xyz", "agent-not-found-xyz"],
|
|
["../../../etc/passwd", "etc-passwd"],
|
|
["_".repeat(80), "_".repeat(64)],
|
|
])("normalizes %j", (input, expected) => {
|
|
expect(normalizeAgentId(input)).toBe(expected);
|
|
});
|
|
|
|
it.each([
|
|
["main", true],
|
|
["my-research_agent01", true],
|
|
["", false],
|
|
["Agent not found: xyz", false],
|
|
["a".repeat(65), false],
|
|
])("validates %j", (input, expected) => {
|
|
expect(isValidAgentId(input)).toBe(expected);
|
|
});
|
|
});
|