fix(portal): show Weight/DoB + Size Category in pet read view (GRO-2207)
Portal GET /api/portal/pets serializes weightKg→weight and dateOfBirth→ birthDate. The portal read view read the staff-shaped keys, so populated pets rendered 'Unknown'. Size Category (petSizeCategory) was never shown in any read tab. - packages/types: add portal-shaped weight?/birthDate? alongside the existing staff-side weightKg/dateOfBirth (no rename — staff Clients pages still use weightKg/dateOfBirth). - PetProfiles: header + Basic Info InfoRows read portal keys with a fallback to staff keys; add a Size Category InfoRow with a formatSizeCategory helper (extra_large → 'Extra Large'). - PetForm: pre-fill weight from portal weight key with weightKg fallback. - Tests: PetProfiles.test.tsx (read view + formatter) and a PetForm pre-fill case. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -154,4 +154,12 @@ describe("PetForm", () => {
|
||||
expect(screen.getByText("Anxious")).toBeTruthy();
|
||||
expect(screen.getByText("Good with kids")).toBeTruthy();
|
||||
});
|
||||
|
||||
// ── Weight pre-fill from portal `weight` key (GRO-2207) ───────────────────────
|
||||
|
||||
it("pre-fills weight from the portal `weight` key when weightKg is absent", () => {
|
||||
const portalPet: Pet = { ...BASE_PET, weightKg: null, weight: "12.50" };
|
||||
render(<PetForm pet={portalPet} onSave={onSave} onCancel={onCancel} />);
|
||||
expect(screen.getByDisplayValue(12.5)).toBeTruthy();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user