Files
PaperClipAI/ui/src/components/AgentAvatar.test.tsx
T
DottaandPaperclip 2b4a1d7073 feat(dot): add guided invitations and persistent agent connections (#15581)
Add guided external-agent invitations with live Dot connection checks and ongoing access until revoked. Keep expired credentials invalid and enforce permissions for private avatar uploads. Preserve Runner recovery and remote launch boundaries.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-08 16:26:41 -05:00

28 lines
1.5 KiB
TypeScript

// @vitest-environment jsdom
import { act } from "react";
import { createRoot } from "react-dom/client";
import { expect, it } from "vitest";
import { appearanceForPalette } from "@paperclipai/shared";
import { AgentAvatar } from "./AgentAvatar";
import { AgentCharacter } from "./AgentCharacter";
Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true });
it("shows the uploaded image in small and animated-character surfaces, then returns to the palette on reset", async () => {
const base = appearanceForPalette("deep-tide");
const appearance = { ...base, customAvatarAssetId: "22222222-2222-4222-8222-222222222222" };
const container = document.createElement("div");
const root = createRoot(container);
try {
await act(async () => root.render(<><AgentAvatar appearance={appearance} /><AgentCharacter appearance={appearance} /></>));
for (const image of container.querySelectorAll("img")) {
expect(image.getAttribute("src")).toBe("/api/assets/22222222-2222-4222-8222-222222222222/content");
expect(image.hasAttribute("srcset")).toBe(false);
expect(image.parentElement?.classList.contains("invisible")).toBe(false);
}
expect(container.querySelectorAll("img")).toHaveLength(2);
expect(container.querySelector("canvas")).toBeNull();
await act(async () => root.render(<AgentAvatar appearance={base} />));
expect(container.querySelector("img")?.getAttribute("src")).toContain("/api/agent-avatars/cap-v1/deep-tide/");
} finally { await act(async () => root.unmount()); }
});