Avatar Customization + Update Agent Brain (#23)

Co-authored-by: iamlukethedev <iamlukethedev@users.noreply.github.com>
This commit is contained in:
Luke The Dev
2026-03-20 23:05:14 -05:00
committed by GitHub
parent a5b0895dd8
commit 65c2b9cf85
39 changed files with 2803 additions and 551 deletions
@@ -0,0 +1,43 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
import { fireEvent, render, screen } from "@testing-library/react";
import { AgentAvatarCreatorModal } from "@/features/agents/components/AgentAvatarCreatorModal";
import { createDefaultAgentAvatarProfile } from "@/lib/avatars/profile";
vi.mock("@/features/agents/components/AgentAvatarPreview3D", () => ({
AgentAvatarPreview3D: () => <div data-testid="avatar-preview-3d">preview</div>,
}));
describe("AgentAvatarCreatorModal", () => {
beforeEach(() => {
vi.restoreAllMocks();
});
it("saves the edited avatar profile", async () => {
const initialProfile = createDefaultAgentAvatarProfile("seed-a");
const onSave = vi.fn(async () => {});
render(
<AgentAvatarCreatorModal
open
agentId="agent-1"
agentName="Agent One"
initialProfile={initialProfile}
onClose={() => {}}
onSave={onSave}
/>
);
fireEvent.click(screen.getByRole("button", { name: "Backpack" }));
fireEvent.click(screen.getByRole("button", { name: "Save avatar" }));
expect(onSave).toHaveBeenCalledTimes(1);
expect(onSave).toHaveBeenCalledWith(
expect.objectContaining({
seed: "seed-a",
accessories: expect.objectContaining({
backpack: !initialProfile.accessories.backpack,
}),
})
);
});
});