fix(subscription): update price formatting to use dot decimal separator
This commit is contained in:
@@ -62,7 +62,7 @@ describe("subscription screen helpers", () => {
|
|||||||
{
|
{
|
||||||
id: "coin_1000",
|
id: "coin_1000",
|
||||||
coins: 1000,
|
coins: 1000,
|
||||||
price: "9,9",
|
price: "9.90",
|
||||||
currency: "US$",
|
currency: "US$",
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
@@ -76,17 +76,33 @@ describe("subscription screen helpers", () => {
|
|||||||
{
|
{
|
||||||
id: "vip_monthly",
|
id: "vip_monthly",
|
||||||
title: "Monthly",
|
title: "Monthly",
|
||||||
price: "19,9",
|
price: "19.90",
|
||||||
currency: "usd",
|
currency: "usd",
|
||||||
originalPrice: "",
|
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");
|
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", () => {
|
it("selects the first VIP plan by default when VIP can be purchased", () => {
|
||||||
expect(
|
expect(
|
||||||
getDefaultSubscriptionPlanId({
|
getDefaultSubscriptionPlanId({
|
||||||
@@ -99,7 +115,7 @@ describe("subscription screen helpers", () => {
|
|||||||
{
|
{
|
||||||
id: "vip_monthly",
|
id: "vip_monthly",
|
||||||
title: "Monthly",
|
title: "Monthly",
|
||||||
price: "19,9",
|
price: "19.90",
|
||||||
currency: "usd",
|
currency: "usd",
|
||||||
originalPrice: "",
|
originalPrice: "",
|
||||||
},
|
},
|
||||||
@@ -122,7 +138,7 @@ describe("subscription screen helpers", () => {
|
|||||||
{
|
{
|
||||||
id: "coin_1000",
|
id: "coin_1000",
|
||||||
coins: 1000,
|
coins: 1000,
|
||||||
price: "9,9",
|
price: "9.90",
|
||||||
currency: "US$",
|
currency: "US$",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -140,7 +156,7 @@ describe("subscription screen helpers", () => {
|
|||||||
selectedPlan: {
|
selectedPlan: {
|
||||||
id: "coin_1000",
|
id: "coin_1000",
|
||||||
coins: 1000,
|
coins: 1000,
|
||||||
price: "9,9",
|
price: "9.90",
|
||||||
currency: "US$",
|
currency: "US$",
|
||||||
},
|
},
|
||||||
vipPlans: [],
|
vipPlans: [],
|
||||||
@@ -148,7 +164,7 @@ describe("subscription screen helpers", () => {
|
|||||||
{
|
{
|
||||||
id: "coin_1000",
|
id: "coin_1000",
|
||||||
coins: 1000,
|
coins: 1000,
|
||||||
price: "9,9",
|
price: "9.90",
|
||||||
currency: "US$",
|
currency: "US$",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ function formatAmount(amountCents: number | null): string | null {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function formatOfferAmount(amountCents: number | null): string {
|
function formatOfferAmount(amountCents: number | null): string {
|
||||||
return (formatAmount(amountCents) ?? "").replace(".", ",");
|
return formatAmount(amountCents) ?? "";
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatOfferCurrency(currency: string): string {
|
function formatOfferCurrency(currency: string): string {
|
||||||
|
|||||||
Reference in New Issue
Block a user