mirror of
https://github.com/hay-kot/homebox.git
synced 2025-07-27 21:00:28 +00:00
feat: add additional currencies (#125)
Add additional currencies and ensure Frontend/Backend currencies are synched via testing
This commit is contained in:
parent
7e0f1fac23
commit
2fb5a437a2
8 changed files with 45 additions and 5 deletions
|
@ -2,6 +2,7 @@ import { faker } from "@faker-js/faker";
|
|||
import { describe, test, expect } from "vitest";
|
||||
import { factories } from "../factories";
|
||||
import { sharedUserClient } from "../test-utils";
|
||||
import { currencies } from "~~/lib/data/currency";
|
||||
|
||||
describe("first time user workflow (register, login, join group)", () => {
|
||||
test("user should be able to update group", async () => {
|
||||
|
@ -28,6 +29,20 @@ describe("first time user workflow (register, login, join group)", () => {
|
|||
expect(group.currency).toBe("USD");
|
||||
});
|
||||
|
||||
test("currencies should be in sync with backend", async () => {
|
||||
const { client } = await factories.client.singleUse();
|
||||
|
||||
for (const currency of currencies) {
|
||||
const { response, data: group } = await client.group.update({
|
||||
name: faker.name.firstName(),
|
||||
currency: currency.code,
|
||||
});
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(group.currency).toBe(currency.code);
|
||||
}
|
||||
});
|
||||
|
||||
test("user should be able to join create join token and have user signup", async () => {
|
||||
const api = factories.client.public();
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export type Codes = "USD" | "EUR" | "GBP" | "JPY";
|
||||
export type Codes = "USD" | "EUR" | "GBP" | "JPY" | "ZAR" | "AUD";
|
||||
|
||||
export type Currency = {
|
||||
code: Codes;
|
||||
|
@ -32,4 +32,16 @@ export const currencies: Currency[] = [
|
|||
symbol: "¥",
|
||||
name: "Japanese Yen",
|
||||
},
|
||||
{
|
||||
code: "ZAR",
|
||||
local: "en-ZA",
|
||||
symbol: "R",
|
||||
name: "South African Rand",
|
||||
},
|
||||
{
|
||||
code: "AUD",
|
||||
local: "en-AU",
|
||||
symbol: "$",
|
||||
name: "Australian Dollar",
|
||||
},
|
||||
];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue