diff --git a/src/app/subscription/__tests__/subscription-screen.helpers.test.ts b/src/app/subscription/__tests__/subscription-screen.helpers.test.ts index 6a6290b5..b1933c1f 100644 --- a/src/app/subscription/__tests__/subscription-screen.helpers.test.ts +++ b/src/app/subscription/__tests__/subscription-screen.helpers.test.ts @@ -62,7 +62,7 @@ describe("subscription screen helpers", () => { { id: "coin_1000", coins: 1000, - price: "9,9", + price: "9.90", currency: "US$", }, ]); @@ -76,17 +76,33 @@ describe("subscription screen helpers", () => { { id: "vip_monthly", title: "Monthly", - price: "19,9", + price: "19.90", currency: "usd", originalPrice: "", }, ], - coinPlans: [{ id: "coin_1000", coins: 1000, price: "9,9", currency: "US$" }], + coinPlans: [{ id: "coin_1000", coins: 1000, price: "9.90", currency: "US$" }], }); expect(selected?.id).toBe("coin_1000"); }); + it("formats plan amounts from cents with a dot decimal separator", () => { + expect( + toVipOfferPlanViews([ + makePlan({ + planId: "vip_test", + amountCents: 7790, + }), + ]), + ).toMatchObject([ + { + id: "vip_test", + price: "77.90", + }, + ]); + }); + it("selects the first VIP plan by default when VIP can be purchased", () => { expect( getDefaultSubscriptionPlanId({ @@ -99,7 +115,7 @@ describe("subscription screen helpers", () => { { id: "vip_monthly", title: "Monthly", - price: "19,9", + price: "19.90", currency: "usd", originalPrice: "", }, @@ -122,7 +138,7 @@ describe("subscription screen helpers", () => { { id: "coin_1000", coins: 1000, - price: "9,9", + price: "9.90", currency: "US$", }, ], @@ -140,7 +156,7 @@ describe("subscription screen helpers", () => { selectedPlan: { id: "coin_1000", coins: 1000, - price: "9,9", + price: "9.90", currency: "US$", }, vipPlans: [], @@ -148,7 +164,7 @@ describe("subscription screen helpers", () => { { id: "coin_1000", coins: 1000, - price: "9,9", + price: "9.90", currency: "US$", }, ], diff --git a/src/app/subscription/subscription-screen.helpers.ts b/src/app/subscription/subscription-screen.helpers.ts index 00c20bca..c06e01fe 100644 --- a/src/app/subscription/subscription-screen.helpers.ts +++ b/src/app/subscription/subscription-screen.helpers.ts @@ -26,7 +26,7 @@ function formatAmount(amountCents: number | null): string | null { } function formatOfferAmount(amountCents: number | null): string { - return (formatAmount(amountCents) ?? "").replace(".", ","); + return formatAmount(amountCents) ?? ""; } function formatOfferCurrency(currency: string): string {