fix(chat): unify insufficient credits prompt

This commit is contained in:
2026-07-16 11:37:11 +08:00
parent 4d24fbc849
commit 764bb5a862
4 changed files with 7 additions and 53 deletions
@@ -11,35 +11,13 @@ afterEach(() => {
});
describe("getInsufficientCreditsMessageLimitView", () => {
it("asks guests to log in for more free chats", () => {
expect(getInsufficientCreditsMessageLimitView("guest")).toEqual({
title: "Log in to get more free chats",
it("shows the same top-up prompt without checking login status", () => {
expect(getInsufficientCreditsMessageLimitView()).toEqual({
title: "Insufficient credits",
description: "Free chats refresh every day.",
ctaLabel: "Log in to continue",
action: "auth",
ctaLabel: "Top up credits to continue",
});
});
it("treats the transient not logged in state like guest", () => {
expect(getInsufficientCreditsMessageLimitView("notLoggedIn")).toEqual({
title: "Log in to get more free chats",
description: "Free chats refresh every day.",
ctaLabel: "Log in to continue",
action: "auth",
});
});
it.each(["email", "facebook", "google"] as const)(
"asks %s users to top up credits",
(loginStatus) => {
expect(getInsufficientCreditsMessageLimitView(loginStatus)).toEqual({
title: "Insufficient credits",
description: "Free chats refresh every day.",
ctaLabel: "Top up credits to continue",
action: "topup",
});
},
);
});
describe("shouldShowMessageLimitBanner", () => {