feat(characters): use local character catalog
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { getCharacterBySlug } from "@/data/constants/character";
|
||||
import { CharacterProvider } from "@/providers/character-provider";
|
||||
|
||||
import { BrowserHintOverlay } from "../browser-hint-overlay";
|
||||
import { ChatHeader } from "../chat-header";
|
||||
import { ChatInsufficientCreditsBanner } from "../chat-insufficient-credits-banner";
|
||||
@@ -35,6 +38,19 @@ describe("chat Tailwind components", () => {
|
||||
expect(userHtml).toContain("%2Fuser-avatar.png");
|
||||
});
|
||||
|
||||
it("renders the active character avatar", () => {
|
||||
const maya = getCharacterBySlug("maya");
|
||||
expect(maya).not.toBeNull();
|
||||
const html = renderToStaticMarkup(
|
||||
<CharacterProvider character={maya!}>
|
||||
<MessageAvatar isFromAI={true} />
|
||||
</CharacterProvider>,
|
||||
);
|
||||
|
||||
expect(html).toContain("%2Fimages%2Favatar%2Fmaya.png");
|
||||
expect(html).toContain('alt="Maya Tan"');
|
||||
});
|
||||
|
||||
it("renders TextBubble AI and user visual variants", () => {
|
||||
const aiHtml = renderToStaticMarkup(
|
||||
<TextBubble content={"hello\nthere"} isFromAI={true} />,
|
||||
@@ -172,7 +188,7 @@ describe("chat Tailwind components", () => {
|
||||
expect(guestHtml).not.toContain('aria-label="Back to home"');
|
||||
expect(guestHtml).not.toContain('aria-label="Menu"');
|
||||
expect(memberHtml).toContain("Offer");
|
||||
expect(memberHtml).toContain('href="/splash"');
|
||||
expect(memberHtml).toContain('href="/characters/elio/splash"');
|
||||
expect(memberHtml).toContain('aria-label="Back to home"');
|
||||
expect(memberHtml).toContain('aria-label="Menu"');
|
||||
expect(memberHtml).toContain('data-analytics-key="chat.open_menu"');
|
||||
|
||||
Reference in New Issue
Block a user