9deb320cf6
Rename the global Sidebar route, UI, assets, analytics, and payment return context to Profile. Add accessible message-avatar navigation and preserve the source character across auth and logout flows. BREAKING CHANGE: /sidebar has been removed; use /profile instead.
36 lines
912 B
TypeScript
36 lines
912 B
TypeScript
import { renderToStaticMarkup } from "react-dom/server";
|
|
import { describe, expect, it, vi } from "vitest";
|
|
|
|
import { CoinsRulesScreen } from "../coins-rules-screen";
|
|
|
|
vi.mock("@/stores/auth/auth-context", () => ({
|
|
useAuthState: () => ({
|
|
hasInitialized: true,
|
|
isLoading: false,
|
|
loginStatus: "email",
|
|
}),
|
|
}));
|
|
|
|
vi.mock("@/stores/user/user-context", () => ({
|
|
useUserDispatch: () => vi.fn(),
|
|
useUserState: () => ({
|
|
currentUser: {
|
|
dailyFreeChatLimit: 30,
|
|
dailyFreePrivateLimit: 2,
|
|
},
|
|
}),
|
|
}));
|
|
|
|
describe("CoinsRulesScreen", () => {
|
|
it("renders outside CharacterProvider and returns to global profile", () => {
|
|
const html = renderToStaticMarkup(
|
|
<CoinsRulesScreen returnTo="/characters/maya/chat" />,
|
|
);
|
|
|
|
expect(html).toContain("Coin Usage Rules");
|
|
expect(html).toContain(
|
|
'href="/profile?returnTo=%2Fcharacters%2Fmaya%2Fchat"',
|
|
);
|
|
});
|
|
});
|