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.
40 lines
1.0 KiB
TypeScript
40 lines
1.0 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import {
|
|
getDefaultPaymentAnalyticsContext,
|
|
parsePaymentAnalyticsContext,
|
|
} from "../payment_analytics_context";
|
|
|
|
describe("payment analytics context", () => {
|
|
it("keeps supported payment entry and reason values", () => {
|
|
expect(
|
|
parsePaymentAnalyticsContext({
|
|
entryPoint: "chat_unlock",
|
|
triggerReason: "ad_landing",
|
|
subscriptionType: "topup",
|
|
}),
|
|
).toEqual({
|
|
entryPoint: "chat_unlock",
|
|
triggerReason: "ad_landing",
|
|
});
|
|
});
|
|
|
|
it("falls back independently for invalid query values", () => {
|
|
expect(
|
|
parsePaymentAnalyticsContext({
|
|
entryPoint: "unsafe-entry",
|
|
triggerReason: "unsafe-reason",
|
|
subscriptionType: "topup",
|
|
}),
|
|
).toEqual(getDefaultPaymentAnalyticsContext("topup"));
|
|
|
|
expect(
|
|
parsePaymentAnalyticsContext({
|
|
entryPoint: "profile",
|
|
triggerReason: null,
|
|
subscriptionType: "vip",
|
|
}),
|
|
).toEqual({ entryPoint: "profile", triggerReason: "vip_cta" });
|
|
});
|
|
});
|