mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-12 06:06:10 +00:00
test(profile): cover the third gender value where it used to be lost
Adds the cases that were missing everywhere except the FHIR conformance suite: an empty string clears without taking its siblings down, OTHER round-trips through the profile and onboarding writes, an unsupported value is still refused and says which field it is about, the Strain model scores an unanswered account on neither side, the dashboard bands give OTHER the neutral fallback, the snapshot payload carries the value instead of flattening it, and the doctor-report cover omits the row rather than claiming a value the account never chose. Refs #645
This commit is contained in:
1 parent
f74efc44aa
commit
349dac3a07
6 files changed
+170
-15
No files matched your search
@@ -29,6 +29,7 @@ import { useTranslations } from "@/lib/i18n/context";
|
||||
import { apiGet, apiPost, apiPut } from "@/lib/api/api-fetch";
|
||||
import { localizedApiError } from "@/lib/api/localized-error";
|
||||
import { queryKeys } from "@/lib/query-keys";
|
||||
import { toProfileSex } from "@/lib/profile/sex";
|
||||
import {
|
||||
AnamnesisCard,
|
||||
buildAnamnesisAboutMeBody,
|
||||
@@ -139,13 +140,11 @@ export function BaselineForm() {
|
||||
const heightCm = heightAdapter.toCanonicalCm(form.height);
|
||||
if (heightCm !== null) profileBody.heightCm = heightCm;
|
||||
if (form.dateOfBirth) profileBody.dateOfBirth = form.dateOfBirth;
|
||||
if (
|
||||
form.gender === "MALE" ||
|
||||
form.gender === "FEMALE" ||
|
||||
form.gender === "OTHER"
|
||||
) {
|
||||
profileBody.gender = form.gender;
|
||||
}
|
||||
// Every value the profile stores travels; the guard drops only the
|
||||
// "prefer not to say" placeholder. It used to list two of the three
|
||||
// by hand, so a third-value answer vanished on submit without a word.
|
||||
const gender = toProfileSex(form.gender);
|
||||
if (gender) profileBody.gender = gender;
|
||||
if (Object.keys(profileBody).length > 0) {
|
||||
await apiPut("/api/auth/profile", profileBody);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user