From a4b096d0899b271ac6ab5275aa77ca257d5a5ff3 Mon Sep 17 00:00:00 2001 From: zebrapurring <> Date: Wed, 17 Sep 2025 22:49:45 +0200 Subject: [PATCH 1/5] chore: ignore all .data directories --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b769d9a28..15a2f2341 100644 --- a/.gitignore +++ b/.gitignore @@ -60,7 +60,7 @@ backend/app/api/static/public/* backend/api docs/.vitepress/cache/ -/.data/ +.data/ # Playwright frontend/test-results/ From bbc6109263f81de23987a38fe90350e47e4010d2 Mon Sep 17 00:00:00 2001 From: zebrapurring <> Date: Wed, 17 Sep 2025 22:51:17 +0200 Subject: [PATCH 2/5] fix: date locale for unit tests --- frontend/lib/datelib/datelib.test.ts | 4 ++-- frontend/lib/datelib/datelib.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/lib/datelib/datelib.test.ts b/frontend/lib/datelib/datelib.test.ts index 34f96f9c4..2d97e695a 100644 --- a/frontend/lib/datelib/datelib.test.ts +++ b/frontend/lib/datelib/datelib.test.ts @@ -3,7 +3,7 @@ import { factorRange, format, parse, zeroTime } from "./datelib"; describe("format", () => { test("should format a date as a string", () => { - const date = new Date(2020, 1, 1); + const date = new Date(Date.UTC(2020, 1, 1)); expect(format(date)).toBe("2020-02-01"); }); @@ -14,7 +14,7 @@ describe("format", () => { describe("zeroTime", () => { test("should zero out the time", () => { - const date = new Date(2020, 1, 1, 12, 30, 30); + const date = new Date(Date.UTC(2020, 1, 1, 12, 30, 30)); const zeroed = zeroTime(date); expect(zeroed.getHours()).toBe(0); expect(zeroed.getMinutes()).toBe(0); diff --git a/frontend/lib/datelib/datelib.ts b/frontend/lib/datelib/datelib.ts index 33f7674da..e82b3127b 100644 --- a/frontend/lib/datelib/datelib.ts +++ b/frontend/lib/datelib/datelib.ts @@ -11,9 +11,9 @@ export function format(date: Date | string): string { } export function zeroTime(date: Date): Date { - return new Date( - new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - date.getTimezoneOffset() * 60000 - ); + const result = new Date(date.getTime()); + result.setHours(0, 0, 0, 0); + return result; } export function factorRange(offset: number = 7): [Date, Date] { From 04354c0fb69710e5514c9e5df650a0bbdddb8663 Mon Sep 17 00:00:00 2001 From: zebrapurring <> Date: Wed, 17 Sep 2025 22:51:48 +0200 Subject: [PATCH 3/5] test: disable parallelism to prevent database locks --- frontend/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/package.json b/frontend/package.json index b9cf4f5bd..dfc88d76d 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -9,7 +9,7 @@ "lint:fix": "eslint --ext \".ts,.js,.vue\" --ignore-pattern \"components/ui\" . --fix", "lint:ci": "eslint --ext \".ts,.js,.vue\" --ignore-pattern \"components/ui\" . --max-warnings 1", "typecheck": "pnpm nuxi typecheck --noEmit", - "test:ci": "TEST_SHUTDOWN_API_SERVER=true vitest --run --config ./test/vitest.config.ts", + "test:ci": "TEST_SHUTDOWN_API_SERVER=true vitest --run --config ./test/vitest.config.ts --no-file-parallelism", "test:local": "TEST_SHUTDOWN_API_SERVER=false && vitest --run --config ./test/vitest.config.ts", "test:watch": " TEST_SHUTDOWN_API_SERVER=false vitest --config ./test/vitest.config.ts" }, From f97fd532bfd7b922b14bb3af870d2b2b3babcb45 Mon Sep 17 00:00:00 2001 From: zebrapurring <> Date: Wed, 17 Sep 2025 23:01:53 +0200 Subject: [PATCH 4/5] chore: fix lint errors --- frontend/components/global/DetailsSection/DetailsSection.vue | 2 -- frontend/composables/utils.ts | 4 +++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/components/global/DetailsSection/DetailsSection.vue b/frontend/components/global/DetailsSection/DetailsSection.vue index fa65d84ba..5ab63d870 100644 --- a/frontend/components/global/DetailsSection/DetailsSection.vue +++ b/frontend/components/global/DetailsSection/DetailsSection.vue @@ -147,6 +147,4 @@ overflow-wrap: break-word; } } - - diff --git a/frontend/composables/utils.ts b/frontend/composables/utils.ts index 6b4cfbfcd..7d964155f 100644 --- a/frontend/composables/utils.ts +++ b/frontend/composables/utils.ts @@ -1,3 +1,5 @@ +import type { CurrenciesCurrency } from "~/lib/api/types/data-contracts"; + export function validDate(dt: Date | string | null | undefined): boolean { if (!dt) { return false; @@ -42,7 +44,7 @@ function clampDecimals(currency: string, decimals: number): number { } // Type guard to validate currency response shape with strict validation -function isValidCurrencyItem(item: any): item is { code: string; decimals: number } { +function isValidCurrencyItem(item: CurrenciesCurrency): boolean { if ( typeof item !== "object" || item === null || From b25e869fcb2b88a408ce9f40893305a641a318ce Mon Sep 17 00:00:00 2001 From: zebrapurring <> Date: Wed, 17 Sep 2025 23:20:30 +0200 Subject: [PATCH 5/5] chore: remove unused function --- frontend/lib/datelib/datelib.test.ts | 13 +------------ frontend/lib/datelib/datelib.ts | 10 ---------- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/frontend/lib/datelib/datelib.test.ts b/frontend/lib/datelib/datelib.test.ts index 2d97e695a..d80b2bdb0 100644 --- a/frontend/lib/datelib/datelib.test.ts +++ b/frontend/lib/datelib/datelib.test.ts @@ -1,16 +1,5 @@ import { describe, expect, test } from "vitest"; -import { factorRange, format, parse, zeroTime } from "./datelib"; - -describe("format", () => { - test("should format a date as a string", () => { - const date = new Date(Date.UTC(2020, 1, 1)); - expect(format(date)).toBe("2020-02-01"); - }); - - test("should return the string if a string is passed in", () => { - expect(format("2020-02-01")).toBe("2020-02-01"); - }); -}); +import { factorRange, parse, zeroTime } from "./datelib"; describe("zeroTime", () => { test("should zero out the time", () => { diff --git a/frontend/lib/datelib/datelib.ts b/frontend/lib/datelib/datelib.ts index e82b3127b..fc7b7b274 100644 --- a/frontend/lib/datelib/datelib.ts +++ b/frontend/lib/datelib/datelib.ts @@ -1,15 +1,5 @@ import { addDays } from "date-fns"; -/* - * Formats a date as a string - * */ -export function format(date: Date | string): string { - if (typeof date === "string") { - return date; - } - return date.toISOString().split("T")[0]!; -} - export function zeroTime(date: Date): Date { const result = new Date(date.getTime()); result.setHours(0, 0, 0, 0);