From ba3ee968c78602321f0d8051970da0b97089bfe3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Wed, 11 Nov 2026 00:22:26 +0100 Subject: [PATCH] style(labs): format the filter rail files --- .../lab-filter-rail.browser.test.tsx | 10 +++--- .../labs/__tests__/lab-filter-rail.test.tsx | 8 ++--- .../labs/__tests__/lab-list-filters.test.ts | 27 +++++++------- .../lab-list-url-sync.browser.test.tsx | 9 +++-- .../labs/__tests__/lab-list-url-sync.test.tsx | 3 +- .../labs/__tests__/lab-list.test.tsx | 3 +- src/components/labs/lab-filter-rail.tsx | 2 +- src/components/labs/lab-list-groups.tsx | 8 ++--- src/components/labs/lab-list.tsx | 5 +-- .../use-url-filter-sync.browser.test.tsx | 9 +++-- .../labs/__tests__/reference-range.test.ts | 35 ++++++++++++++++--- 11 files changed, 74 insertions(+), 45 deletions(-) diff --git a/src/components/labs/__tests__/lab-filter-rail.browser.test.tsx b/src/components/labs/__tests__/lab-filter-rail.browser.test.tsx index a5199067f..2a38d01e1 100644 --- a/src/components/labs/__tests__/lab-filter-rail.browser.test.tsx +++ b/src/components/labs/__tests__/lab-filter-rail.browser.test.tsx @@ -72,9 +72,9 @@ describe(" layout", () => { .closest('[data-slot="filter-bar"]') ?.querySelector("svg.lucide-list-filter, svg.lucide-funnel"); expect(icon).toBeTruthy(); - expect(Math.abs(centerY(icon!) - centerY(dateRange.element()))).toBeLessThan( - 2, - ); + expect( + Math.abs(centerY(icon!) - centerY(dateRange.element())), + ).toBeLessThan(2); expect(document.documentElement.scrollWidth).toBeLessThanOrEqual(390); }); @@ -199,7 +199,9 @@ describe(" keyboard", () => { const search = screen.getByRole("searchbox", { name: "Search biomarkers" }); ( - screen.getByRole("button", { name: "Open dialog" }).element() as HTMLElement + screen + .getByRole("button", { name: "Open dialog" }) + .element() as HTMLElement ).focus(); await userEvent.keyboard("/"); await expect.element(search).toHaveFocus(); diff --git a/src/components/labs/__tests__/lab-filter-rail.test.tsx b/src/components/labs/__tests__/lab-filter-rail.test.tsx index 89ffe0233..2208fa256 100644 --- a/src/components/labs/__tests__/lab-filter-rail.test.tsx +++ b/src/components/labs/__tests__/lab-filter-rail.test.tsx @@ -83,14 +83,12 @@ describe("", () => { ); expect(html).toContain('aria-label="Clear search"'); - expect(html).not.toContain(' { const extractCountText = (html: string) => { - const match = html.match( - /]*tabular-nums[^>]*>([^<]+)<\/span>/, - ); + const match = html.match(/]*tabular-nums[^>]*>([^<]+)<\/span>/); return match ? match[1].trim() : null; }; @@ -106,7 +104,7 @@ describe("", () => { onCategoryChange={vi.fn()} onFromDayChange={vi.fn()} onToDayChange={vi.fn()} - onResetFilters={vi.fn()} + onResetFilters={vi.fn()} isFiltered={false} total={total} /> diff --git a/src/components/labs/__tests__/lab-list-filters.test.ts b/src/components/labs/__tests__/lab-list-filters.test.ts index 4affdcb55..e1088ba13 100644 --- a/src/components/labs/__tests__/lab-list-filters.test.ts +++ b/src/components/labs/__tests__/lab-list-filters.test.ts @@ -178,9 +178,7 @@ describe("filterMarkerRows", () => { accented, ]); expect(filterMarkerRows([accented], { q: "hämo" })).toEqual([accented]); - expect(filterMarkerRows([accented], { q: "blutbild" })).toEqual([ - accented, - ]); + expect(filterMarkerRows([accented], { q: "blutbild" })).toEqual([accented]); expect(filterMarkerRows([accented], { q: "ferritin" })).toEqual([]); }); @@ -269,12 +267,7 @@ describe("filterMarkerRows", () => { ), ).toEqual([]); expect( - filterMarkerRows( - [lateRow], - { toDay: "2026-08-31" }, - undefined, - dayKeyNy, - ), + filterMarkerRows([lateRow], { toDay: "2026-08-31" }, undefined, dayKeyNy), ).toEqual([lateRow]); }); }); @@ -319,8 +312,12 @@ describe("labReadingDayKey", () => { it("keeps noon UTC anchors on their stated date across all timezones", () => { const noonInstant = "2026-09-01T12:00:00.000Z"; expect(labReadingDayKey(noonInstant, "UTC")).toBe("2026-09-01"); - expect(labReadingDayKey(noonInstant, "America/New_York")).toBe("2026-09-01"); - expect(labReadingDayKey(noonInstant, "Pacific/Kiritimati")).toBe("2026-09-01"); + expect(labReadingDayKey(noonInstant, "America/New_York")).toBe( + "2026-09-01", + ); + expect(labReadingDayKey(noonInstant, "Pacific/Kiritimati")).toBe( + "2026-09-01", + ); }); it("documents exact-noon date-anchor ambiguity vs true instant timestamps", () => { @@ -329,12 +326,16 @@ describe("labReadingDayKey", () => { // `useLabDate` / `date-only.ts`. In Pacific/Kiritimati (UTC+14), 12:00 UTC would be // 02:00 on the NEXT calendar day if treated as an instant; but as an anchor it stays 2026-09-01. const noonAnchor = "2026-09-01T12:00:00.000Z"; - expect(labReadingDayKey(noonAnchor, "Pacific/Kiritimati")).toBe("2026-09-01"); + expect(labReadingDayKey(noonAnchor, "Pacific/Kiritimati")).toBe( + "2026-09-01", + ); // Any non-noon instant (even 1 second off noon) is recognized as a true instant with time // and correctly shifts to the local date in the user's timezone: const nonNoonInstant = "2026-09-01T12:00:01.000Z"; - expect(labReadingDayKey(nonNoonInstant, "Pacific/Kiritimati")).toBe("2026-09-02"); + expect(labReadingDayKey(nonNoonInstant, "Pacific/Kiritimati")).toBe( + "2026-09-02", + ); expect(labReadingDayKey(nonNoonInstant, "UTC")).toBe("2026-09-01"); }); diff --git a/src/components/labs/__tests__/lab-list-url-sync.browser.test.tsx b/src/components/labs/__tests__/lab-list-url-sync.browser.test.tsx index 08879aa22..f143574fd 100644 --- a/src/components/labs/__tests__/lab-list-url-sync.browser.test.tsx +++ b/src/components/labs/__tests__/lab-list-url-sync.browser.test.tsx @@ -3,7 +3,10 @@ import type { QueryClient } from "@tanstack/react-query"; import { describe, expect, it } from "vitest"; import { queryKeys } from "@/lib/query-keys"; -import { renderWithApp, testQueryClient } from "../../../../tests/browser/render"; +import { + renderWithApp, + testQueryClient, +} from "../../../../tests/browser/render"; import { currentSearch, recordHistory, @@ -210,7 +213,9 @@ describe("LabList stale category and group header handling", () => { // Group header button shows the filtered count ("1 of 1 outside range") and chip "1" const groupButton = screen.getByRole("button", { name: /Iron Panel/i }); await expect.element(groupButton).toBeVisible(); - await expect.element(groupButton.getByText("1 of 1 outside range")).toBeVisible(); + await expect + .element(groupButton.getByText("1 of 1 outside range")) + .toBeVisible(); await expect.element(groupButton.getByText("1")).toBeVisible(); }); diff --git a/src/components/labs/__tests__/lab-list-url-sync.test.tsx b/src/components/labs/__tests__/lab-list-url-sync.test.tsx index 967ae101e..822027c47 100644 --- a/src/components/labs/__tests__/lab-list-url-sync.test.tsx +++ b/src/components/labs/__tests__/lab-list-url-sync.test.tsx @@ -52,7 +52,8 @@ const mockModulePrefs: ModuleListPrefs = { }; vi.mock("@/lib/module-list-prefs", async (importOriginal) => { - const actual = await importOriginal(); + const actual = + await importOriginal(); return { ...actual, useModuleListPrefs: () => ({ diff --git a/src/components/labs/__tests__/lab-list.test.tsx b/src/components/labs/__tests__/lab-list.test.tsx index 9698a9290..eef03dcc5 100644 --- a/src/components/labs/__tests__/lab-list.test.tsx +++ b/src/components/labs/__tests__/lab-list.test.tsx @@ -35,7 +35,8 @@ vi.mock("@/lib/i18n/context", async (importOriginal) => { }); vi.mock("@/lib/module-list-prefs", async (importOriginal) => { - const actual = await importOriginal(); + const actual = + await importOriginal(); return { ...actual, useModuleListPrefs: () => ({ diff --git a/src/components/labs/lab-filter-rail.tsx b/src/components/labs/lab-filter-rail.tsx index 660df9fdf..6b4b9117b 100644 --- a/src/components/labs/lab-filter-rail.tsx +++ b/src/components/labs/lab-filter-rail.tsx @@ -106,7 +106,7 @@ export function LabFilterRail({ searchInputRef.current?.focus(); }} aria-label={t("labs.filter.clearSearch")} - className="text-muted-foreground hover:text-foreground focus-visible:ring-ring/50 absolute top-1/2 right-0 inline-flex size-11 -translate-y-1/2 sm:size-10 items-center justify-center rounded-full outline-none focus-visible:ring-[3px]" + className="text-muted-foreground hover:text-foreground focus-visible:ring-ring/50 absolute top-1/2 right-0 inline-flex size-11 -translate-y-1/2 items-center justify-center rounded-full outline-none focus-visible:ring-[3px] sm:size-10" >