style(medications): prettier sweep on the W3 intake-history fix

Run prettier --write on the four files the v1.4.37 W3 commits
touched (the schema, the route, the V2 component, and the two test
files). Drive-by also collapses two pre-existing whitespace drifts
in the InventoryItem type aliases and the glp1PostBodySchema refine
call so the file matches the formatter contract end-to-end. No
behavioural change.
This commit is contained in:
Marc-André Bombeck committed 2026-05-17 14:15:41 +02:00
1 parent 04aa2fc8b9
commit f33c70b3a2
6 files changed
+74 -55

No files matched your search

@@ -134,10 +134,7 @@ describe("GET /api/medications/[id]/intake — status filter", () => {
expect(where).toEqual({
medicationId: "med-1",
userId: "user-1",
OR: [
{ takenAt: { not: null }, skipped: false },
{ skipped: true },
],
OR: [{ takenAt: { not: null }, skipped: false }, { skipped: true }],
});
});
@@ -154,10 +151,7 @@ describe("GET /api/medications/[id]/intake — status filter", () => {
expect(countArgs?.where).toEqual({
medicationId: "med-1",
userId: "user-1",
OR: [
{ takenAt: { not: null }, skipped: false },
{ skipped: true },
],
OR: [{ takenAt: { not: null }, skipped: false }, { skipped: true }],
});
});
});
@@ -96,10 +96,7 @@ describe("<IntakeHistoryListV2> — empty state", () => {
it("renders the empty-state title and CTA in English", () => {
const client = makeClient();
seedIntake(client, "med-1", []);
const html = render(
<IntakeHistoryListV2 medicationId="med-1" />,
client,
);
const html = render(<IntakeHistoryListV2 medicationId="med-1" />, client);
expect(html).toContain("No intakes recorded yet");
expect(html).toContain("Open daily intake");
expect(html).toContain('href="/medications"');
@@ -141,10 +138,7 @@ describe("<IntakeHistoryListV2> — populated rows", () => {
createdAt: "2026-05-14T20:00:00.000Z",
},
]);
const html = render(
<IntakeHistoryListV2 medicationId="med-1" />,
client,
);
const html = render(<IntakeHistoryListV2 medicationId="med-1" />, client);
expect(html).toContain("Taken");
expect(html).toContain("Skipped");
expect(html).toContain("Website");
@@ -238,10 +232,7 @@ describe("<IntakeHistoryListV2> — populated rows", () => {
it("renders the section title across both locales", () => {
const client = makeClient();
seedIntake(client, "med-1", []);
const enHtml = render(
<IntakeHistoryListV2 medicationId="med-1" />,
client,
);
const enHtml = render(<IntakeHistoryListV2 medicationId="med-1" />, client);
expect(enHtml).toContain("Intake history");
const deClient = makeClient();
@@ -269,10 +260,7 @@ describe("<IntakeHistoryListV2> — sort indicators", () => {
createdAt: "2026-05-15T08:02:00.000Z",
},
]);
const html = render(
<IntakeHistoryListV2 medicationId="med-1" />,
client,
);
const html = render(<IntakeHistoryListV2 medicationId="med-1" />, client);
// Default sort = takenAt desc, so the "taken" header carries the
// arrow-down icon and the "scheduled" header carries the neutral
// dual-arrow icon.
@@ -322,10 +310,7 @@ describe("<IntakeHistoryListV2> — sort indicators", () => {
],
50,
);
const html = render(
<IntakeHistoryListV2 medicationId="med-2" />,
client,
);
const html = render(<IntakeHistoryListV2 medicationId="med-2" />, client);
expect(html).toContain("Previous");
expect(html).toContain("Next");
// a11y: pagination buttons clear the 44 px mobile touch floor and
@@ -352,10 +337,7 @@ describe("<IntakeHistoryListV2> — sort indicators", () => {
],
1,
);
const html = render(
<IntakeHistoryListV2 medicationId="med-3" />,
client,
);
const html = render(<IntakeHistoryListV2 medicationId="med-3" />, client);
expect(html).not.toContain(">Previous<");
expect(html).not.toContain(">Next<");
});
@@ -17,12 +17,7 @@ import { useAuth } from "@/hooks/use-auth";
import { useTranslations, useFormatters } from "@/lib/i18n/context";
import { Button } from "@/components/ui/button";
import { Badge } from "@/components/ui/badge";
import {
Card,
CardContent,
CardHeader,
CardTitle,
} from "@/components/ui/card";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { EmptyState } from "@/components/ui/empty-state";
import {
Table,
@@ -233,8 +228,12 @@ export function IntakeHistoryListV2({
{sortIndicator("scheduledFor")}
</button>
</TableHead>
<TableHead>{t("medications.intakeHistoryColStatus")}</TableHead>
<TableHead>{t("medications.intakeHistoryColSource")}</TableHead>
<TableHead>
{t("medications.intakeHistoryColStatus")}
</TableHead>
<TableHead>
{t("medications.intakeHistoryColSource")}
</TableHead>
</TableRow>
</TableHeader>
<TableBody>
@@ -264,10 +263,7 @@ export function IntakeHistoryListV2({
variant="secondary"
className="gap-1 bg-green-500/20 text-xs text-green-400"
>
<Check
aria-hidden="true"
className="h-3 w-3"
/>
<Check aria-hidden="true" className="h-3 w-3" />
{t("medications.intakeHistoryStatusTaken")}
</Badge>
) : isSkipped ? (
+10 -11
View File
@@ -160,8 +160,12 @@ export const updateInventoryItemSchema = z.object({
notes: z.string().max(200).nullable().optional(),
});
export type CreateInventoryItemInput = z.infer<typeof createInventoryItemSchema>;
export type UpdateInventoryItemInput = z.infer<typeof updateInventoryItemSchema>;
export type CreateInventoryItemInput = z.infer<
typeof createInventoryItemSchema
>;
export type UpdateInventoryItemInput = z.infer<
typeof updateInventoryItemSchema
>;
/**
* v1.4.25 W21 Fix-K — `POST /api/medications/[id]/glp1` body validators.
@@ -200,11 +204,7 @@ export const glp1DoseChangePostSchema = z.object({
.refine((d) => d.getTime() <= Date.now() + FIVE_YEARS_MS, {
message: "effectiveFrom must be within 5 years of now",
}),
doseValue: z
.number()
.finite()
.min(0)
.max(MAX_DOSE_MG),
doseValue: z.number().finite().min(0).max(MAX_DOSE_MG),
doseUnit: z.string().min(1).max(10),
note: z.string().max(MAX_NOTE_CHARS).nullable().optional(),
});
@@ -225,10 +225,9 @@ export const glp1PostBodySchema = z
doseChange: glp1DoseChangePostSchema.optional(),
inventory: glp1InventoryPostSchema.optional(),
})
.refine(
(b) => Boolean(b.doseChange) !== Boolean(b.inventory),
{ message: "Body must carry exactly one of doseChange or inventory" },
);
.refine((b) => Boolean(b.doseChange) !== Boolean(b.inventory), {
message: "Body must carry exactly one of doseChange or inventory",
});
export type Glp1DoseChangePostInput = z.infer<typeof glp1DoseChangePostSchema>;
export type Glp1InventoryPostInput = z.infer<typeof glp1InventoryPostSchema>;