describe("sortLocaleStrings", () => {
it("sorts values using localeCompare without relying on Array.prototype.toSorted", () => {
expect(sortLocaleStrings(["z", "b", "a"])).toEqual(["a", "b", "z"]);
});
it("accepts any iterable input, including sets", () => {
expect(sortLocaleStrings(new Set(["beta", "alpha"]))).toEqual(["alpha", "beta"]);
});
});
describe("agentLogoUrl", () => {
it("keeps base-mounted control UI logo paths absolute to the mount", () => {
expect(agentLogoUrl("/ui")).toBe("/ui/favicon.svg");
expect(agentLogoUrl("/apps/openclaw/")).toBe("/apps/openclaw/favicon.svg");
});
it("uses a route-relative fallback before basePath bootstrap finishes", () => {
expect(agentLogoUrl("")).toBe("favicon.svg");
});
});
it("ignores remote http avatars so the control UI falls back to a local badge", () => {
expect(
resolveAgentAvatarUrl({
identity: { avatarUrl: "https://example.com/avatar.png" },
}),
).toBeNull();
});
it("ignores protocol-relative avatars so the control UI cannot be tricked into a cross-origin fetch", () => {
expect(
resolveAgentAvatarUrl({
identity: { avatarUrl: "//evil.example/avatar.png" },
}),
).toBeNull();
});
it("returns null for initials or emoji avatar values without a URL", () => {
expect(resolveAgentAvatarUrl({ identity: { avatar: "A" } })).toBeNull();
expect(resolveAgentAvatarUrl({ identity: { avatar: "" } })).toBeNull();
});
});
describe("resolveChatAvatarRenderUrl", () => {
it("accepts a blob: URL produced by an authenticated avatar fetch", () => {
expect(
resolveChatAvatarRenderUrl("blob:http://localhost/uuid-123", {
identity: { avatarUrl: "/avatar/main" },
}),
).toBe("blob:http://localhost/uuid-123");
});
it("falls back to the config-sanitized avatar when no blob candidate is present", () => {
expect(
resolveChatAvatarRenderUrl(null, {
identity: { avatarUrl: "/avatar/main" },
}),
).toBe("/avatar/main");
});
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.