From 2bfc5aee4b3ff1be37b0b8b72fad018f65bd7c4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Fri, 23 Oct 2026 11:35:33 +0200 Subject: [PATCH] test(dashboard): pin the widgets layout route before moving its logic Record the parity walk for GET, PUT and DELETE /api/dashboard/widgets on the current code: the first and the cached read, a full save with ids outside the catalogue, a partial save that keeps stored fields and the per-chart range, the schema, empty-body and base-token refusals, a save on the current token, the recovery-off availability probe with and without an HRV series, a delegate's read and refused writes, the reset, and an anonymous call. --- ...dashboard-widgets.01-get-default.json.snap | 219 +++++++++ .../dashboard-widgets.02-get-cached.json.snap | 219 +++++++++ ...-widgets.03-put-full-unknown-ids.json.snap | 419 +++++++++++++++++ ...-widgets.04-put-partial-preserve.json.snap | 428 +++++++++++++++++ ...dashboard-widgets.05-put-invalid.json.snap | 271 +++++++++++ ...hboard-widgets.06-put-empty-body.json.snap | 224 +++++++++ ...oard-widgets.07-put-invalid-base.json.snap | 224 +++++++++ ...hboard-widgets.08-put-stale-base.json.snap | 228 +++++++++ ...oard-widgets.09-put-current-base.json.snap | 430 +++++++++++++++++ ...gets.10a-get-recovery-off-no-hrv.json.snap | 432 +++++++++++++++++ ...dgets.10b-get-recovery-off-rmssd.json.snap | 429 +++++++++++++++++ ...shboard-widgets.11a-delegate-get.json.snap | 429 +++++++++++++++++ ...shboard-widgets.11b-delegate-put.json.snap | 230 +++++++++ ...oard-widgets.11c-delegate-delete.json.snap | 230 +++++++++ ...ashboard-widgets.12-delete-reset.json.snap | 436 +++++++++++++++++ ...board-widgets.13-get-after-reset.json.snap | 437 ++++++++++++++++++ ...shboard-widgets.14-anonymous-get.json.snap | 226 +++++++++ .../parity/dashboard-widgets.parity.test.ts | 313 +++++++++++++ 18 files changed, 5824 insertions(+) create mode 100644 tests/integration/routes/parity/__snapshots__/dashboard-widgets.01-get-default.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/dashboard-widgets.02-get-cached.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/dashboard-widgets.03-put-full-unknown-ids.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/dashboard-widgets.04-put-partial-preserve.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/dashboard-widgets.05-put-invalid.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/dashboard-widgets.06-put-empty-body.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/dashboard-widgets.07-put-invalid-base.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/dashboard-widgets.08-put-stale-base.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/dashboard-widgets.09-put-current-base.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/dashboard-widgets.10a-get-recovery-off-no-hrv.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/dashboard-widgets.10b-get-recovery-off-rmssd.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/dashboard-widgets.11a-delegate-get.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/dashboard-widgets.11b-delegate-put.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/dashboard-widgets.11c-delegate-delete.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/dashboard-widgets.12-delete-reset.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/dashboard-widgets.13-get-after-reset.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/dashboard-widgets.14-anonymous-get.json.snap create mode 100644 tests/integration/routes/parity/dashboard-widgets.parity.test.ts diff --git a/tests/integration/routes/parity/__snapshots__/dashboard-widgets.01-get-default.json.snap b/tests/integration/routes/parity/__snapshots__/dashboard-widgets.01-get-default.json.snap new file mode 100644 index 000000000..e782b90aa --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/dashboard-widgets.01-get-default.json.snap @@ -0,0 +1,219 @@ +{ + "status": 200, + "body": { + "data": { + "version": 1, + "selectedScoreRings": [ + "MED_COMPLIANCE" + ], + "heroRingOrder": [ + "HEALTH_SCORE", + "MED_COMPLIANCE" + ], + "enabledHeroItemKinds": [ + "coach_checkin", + "dose_window", + "preventive_care", + "sync_issue", + "milestone", + "ecg_new_recording", + "tension_window", + "same_time_baseline", + "upcoming_visit" + ], + "hero": "score", + "todayCardVisible": true, + "widgets": [ + { + "id": "weight", + "visible": true, + "tileVisible": true, + "order": 0 + }, + { + "id": "bp", + "visible": true, + "tileVisible": true, + "order": 1 + }, + { + "id": "pulse", + "visible": true, + "tileVisible": true, + "order": 2 + }, + { + "id": "hrv", + "visible": false, + "tileVisible": true, + "order": 3 + }, + { + "id": "oxygenSaturation", + "visible": false, + "tileVisible": true, + "order": 4 + }, + { + "id": "respiratoryRate", + "visible": false, + "tileVisible": true, + "order": 5 + }, + { + "id": "wristTemperature", + "visible": false, + "tileVisible": true, + "order": 6 + }, + { + "id": "bodyFat", + "visible": true, + "tileVisible": true, + "order": 7 + }, + { + "id": "muscleMass", + "visible": false, + "tileVisible": true, + "order": 8 + }, + { + "id": "totalBodyWater", + "visible": false, + "tileVisible": true, + "order": 9 + }, + { + "id": "boneMass", + "visible": false, + "tileVisible": true, + "order": 10 + }, + { + "id": "mood", + "visible": true, + "tileVisible": true, + "order": 11 + }, + { + "id": "bpInTarget", + "visible": true, + "tileVisible": true, + "order": 12 + }, + { + "id": "medications", + "visible": true, + "tileVisible": true, + "order": 13 + }, + { + "id": "sleep", + "visible": false, + "tileVisible": true, + "order": 14 + }, + { + "id": "steps", + "visible": false, + "tileVisible": true, + "order": 15 + }, + { + "id": "glucose", + "visible": false, + "tileVisible": true, + "order": 16 + }, + { + "id": "achievements", + "visible": true, + "tileVisible": false, + "order": 17 + }, + { + "id": "vo2Max", + "visible": false, + "tileVisible": true, + "order": 18 + }, + { + "id": "recentWorkouts", + "visible": true, + "tileVisible": true, + "order": 19 + }, + { + "id": "cardioRecovery", + "visible": false, + "tileVisible": false, + "order": 20 + }, + { + "id": "sixMinuteWalk", + "visible": false, + "tileVisible": false, + "order": 21 + }, + { + "id": "stairAscentSpeed", + "visible": false, + "tileVisible": false, + "order": 22 + }, + { + "id": "stairDescentSpeed", + "visible": false, + "tileVisible": false, + "order": 23 + }, + { + "id": "breathingDisturbances", + "visible": false, + "tileVisible": false, + "order": 24 + }, + { + "id": "falls", + "visible": false, + "tileVisible": false, + "order": 25 + }, + { + "id": "walkingSteadiness", + "visible": false, + "tileVisible": false, + "order": 26 + }, + { + "id": "vorsorge", + "visible": true, + "tileVisible": false, + "order": 27 + }, + { + "id": "waterIntake", + "visible": false, + "tileVisible": true, + "order": 28 + } + ], + "updatedAt": "" + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": null, + "meta": { + "cache.dashboardWidgets.outcome": "miss", + "cache.dashboardWidgets.key_hash": "" + }, + "warnings": null, + "error": null + } + ], + "stored": null +} diff --git a/tests/integration/routes/parity/__snapshots__/dashboard-widgets.02-get-cached.json.snap b/tests/integration/routes/parity/__snapshots__/dashboard-widgets.02-get-cached.json.snap new file mode 100644 index 000000000..fd505c472 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/dashboard-widgets.02-get-cached.json.snap @@ -0,0 +1,219 @@ +{ + "status": 200, + "body": { + "data": { + "version": 1, + "selectedScoreRings": [ + "MED_COMPLIANCE" + ], + "heroRingOrder": [ + "HEALTH_SCORE", + "MED_COMPLIANCE" + ], + "enabledHeroItemKinds": [ + "coach_checkin", + "dose_window", + "preventive_care", + "sync_issue", + "milestone", + "ecg_new_recording", + "tension_window", + "same_time_baseline", + "upcoming_visit" + ], + "hero": "score", + "todayCardVisible": true, + "widgets": [ + { + "id": "weight", + "visible": true, + "tileVisible": true, + "order": 0 + }, + { + "id": "bp", + "visible": true, + "tileVisible": true, + "order": 1 + }, + { + "id": "pulse", + "visible": true, + "tileVisible": true, + "order": 2 + }, + { + "id": "hrv", + "visible": false, + "tileVisible": true, + "order": 3 + }, + { + "id": "oxygenSaturation", + "visible": false, + "tileVisible": true, + "order": 4 + }, + { + "id": "respiratoryRate", + "visible": false, + "tileVisible": true, + "order": 5 + }, + { + "id": "wristTemperature", + "visible": false, + "tileVisible": true, + "order": 6 + }, + { + "id": "bodyFat", + "visible": true, + "tileVisible": true, + "order": 7 + }, + { + "id": "muscleMass", + "visible": false, + "tileVisible": true, + "order": 8 + }, + { + "id": "totalBodyWater", + "visible": false, + "tileVisible": true, + "order": 9 + }, + { + "id": "boneMass", + "visible": false, + "tileVisible": true, + "order": 10 + }, + { + "id": "mood", + "visible": true, + "tileVisible": true, + "order": 11 + }, + { + "id": "bpInTarget", + "visible": true, + "tileVisible": true, + "order": 12 + }, + { + "id": "medications", + "visible": true, + "tileVisible": true, + "order": 13 + }, + { + "id": "sleep", + "visible": false, + "tileVisible": true, + "order": 14 + }, + { + "id": "steps", + "visible": false, + "tileVisible": true, + "order": 15 + }, + { + "id": "glucose", + "visible": false, + "tileVisible": true, + "order": 16 + }, + { + "id": "achievements", + "visible": true, + "tileVisible": false, + "order": 17 + }, + { + "id": "vo2Max", + "visible": false, + "tileVisible": true, + "order": 18 + }, + { + "id": "recentWorkouts", + "visible": true, + "tileVisible": true, + "order": 19 + }, + { + "id": "cardioRecovery", + "visible": false, + "tileVisible": false, + "order": 20 + }, + { + "id": "sixMinuteWalk", + "visible": false, + "tileVisible": false, + "order": 21 + }, + { + "id": "stairAscentSpeed", + "visible": false, + "tileVisible": false, + "order": 22 + }, + { + "id": "stairDescentSpeed", + "visible": false, + "tileVisible": false, + "order": 23 + }, + { + "id": "breathingDisturbances", + "visible": false, + "tileVisible": false, + "order": 24 + }, + { + "id": "falls", + "visible": false, + "tileVisible": false, + "order": 25 + }, + { + "id": "walkingSteadiness", + "visible": false, + "tileVisible": false, + "order": 26 + }, + { + "id": "vorsorge", + "visible": true, + "tileVisible": false, + "order": 27 + }, + { + "id": "waterIntake", + "visible": false, + "tileVisible": true, + "order": 28 + } + ], + "updatedAt": "" + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": null, + "meta": { + "cache.dashboardWidgets.outcome": "hit", + "cache.dashboardWidgets.key_hash": "" + }, + "warnings": null, + "error": null + } + ], + "stored": null +} diff --git a/tests/integration/routes/parity/__snapshots__/dashboard-widgets.03-put-full-unknown-ids.json.snap b/tests/integration/routes/parity/__snapshots__/dashboard-widgets.03-put-full-unknown-ids.json.snap new file mode 100644 index 000000000..6ff77eac3 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/dashboard-widgets.03-put-full-unknown-ids.json.snap @@ -0,0 +1,419 @@ +{ + "status": 200, + "body": { + "data": { + "version": 1, + "widgets": [ + { + "id": "weight", + "visible": true, + "tileVisible": true, + "order": 0 + }, + { + "id": "bp", + "visible": true, + "tileVisible": true, + "order": 1 + }, + { + "id": "pulse", + "visible": true, + "tileVisible": true, + "order": 2 + }, + { + "id": "hrv", + "visible": false, + "tileVisible": true, + "order": 3 + }, + { + "id": "oxygenSaturation", + "visible": false, + "tileVisible": true, + "order": 4 + }, + { + "id": "respiratoryRate", + "visible": false, + "tileVisible": true, + "order": 5 + }, + { + "id": "wristTemperature", + "visible": false, + "tileVisible": true, + "order": 6 + }, + { + "id": "bodyFat", + "visible": true, + "tileVisible": true, + "order": 7 + }, + { + "id": "muscleMass", + "visible": false, + "tileVisible": true, + "order": 8 + }, + { + "id": "totalBodyWater", + "visible": false, + "tileVisible": true, + "order": 9 + }, + { + "id": "boneMass", + "visible": false, + "tileVisible": true, + "order": 10 + }, + { + "id": "mood", + "visible": true, + "tileVisible": true, + "order": 11 + }, + { + "id": "bpInTarget", + "visible": true, + "tileVisible": true, + "order": 12 + }, + { + "id": "medications", + "visible": true, + "tileVisible": true, + "order": 13 + }, + { + "id": "sleep", + "visible": false, + "tileVisible": true, + "order": 14 + }, + { + "id": "steps", + "visible": false, + "tileVisible": true, + "order": 15 + }, + { + "id": "glucose", + "visible": false, + "tileVisible": true, + "order": 16 + }, + { + "id": "achievements", + "visible": true, + "tileVisible": false, + "order": 17 + }, + { + "id": "vo2Max", + "visible": false, + "tileVisible": true, + "order": 18 + }, + { + "id": "recentWorkouts", + "visible": true, + "tileVisible": true, + "order": 19 + }, + { + "id": "cardioRecovery", + "visible": false, + "tileVisible": false, + "order": 20 + }, + { + "id": "sixMinuteWalk", + "visible": false, + "tileVisible": false, + "order": 21 + }, + { + "id": "stairAscentSpeed", + "visible": false, + "tileVisible": false, + "order": 22 + }, + { + "id": "stairDescentSpeed", + "visible": false, + "tileVisible": false, + "order": 23 + }, + { + "id": "breathingDisturbances", + "visible": false, + "tileVisible": false, + "order": 24 + }, + { + "id": "falls", + "visible": false, + "tileVisible": false, + "order": 25 + }, + { + "id": "walkingSteadiness", + "visible": false, + "tileVisible": false, + "order": 26 + }, + { + "id": "vorsorge", + "visible": true, + "tileVisible": false, + "order": 27 + }, + { + "id": "waterIntake", + "visible": false, + "tileVisible": true, + "order": 28 + } + ], + "comparisonBaseline": "lastMonth", + "chartOverlayPrefs": { + "weight": { + "showTrendIndicator": true, + "showTrendArrow": false, + "showTargetRange": true, + "comparisonBaseline": "none", + "rangePoints": 30 + } + }, + "selectedScoreRings": [ + "MED_COMPLIANCE" + ], + "heroRingOrder": [ + "HEALTH_SCORE", + "MED_COMPLIANCE" + ], + "enabledHeroItemKinds": [], + "updatedAt": "" + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "dashboard.widgets.update" + }, + "meta": { + "dropped_ids": [ + "retired-tile", + "typo-tile" + ], + "dropped_count": 2, + "visible_count": 10 + }, + "warnings": null, + "error": null + } + ], + "stored": { + "version": 1, + "widgets": [ + { + "id": "weight", + "order": 0, + "visible": true, + "tileVisible": true + }, + { + "id": "bp", + "order": 1, + "visible": true, + "tileVisible": true + }, + { + "id": "pulse", + "order": 2, + "visible": true, + "tileVisible": true + }, + { + "id": "hrv", + "order": 3, + "visible": false, + "tileVisible": true + }, + { + "id": "oxygenSaturation", + "order": 4, + "visible": false, + "tileVisible": true + }, + { + "id": "respiratoryRate", + "order": 5, + "visible": false, + "tileVisible": true + }, + { + "id": "wristTemperature", + "order": 6, + "visible": false, + "tileVisible": true + }, + { + "id": "bodyFat", + "order": 7, + "visible": true, + "tileVisible": true + }, + { + "id": "muscleMass", + "order": 8, + "visible": false, + "tileVisible": true + }, + { + "id": "totalBodyWater", + "order": 9, + "visible": false, + "tileVisible": true + }, + { + "id": "boneMass", + "order": 10, + "visible": false, + "tileVisible": true + }, + { + "id": "mood", + "order": 11, + "visible": true, + "tileVisible": true + }, + { + "id": "bpInTarget", + "order": 12, + "visible": true, + "tileVisible": true + }, + { + "id": "medications", + "order": 13, + "visible": true, + "tileVisible": true + }, + { + "id": "sleep", + "order": 14, + "visible": false, + "tileVisible": true + }, + { + "id": "steps", + "order": 15, + "visible": false, + "tileVisible": true + }, + { + "id": "glucose", + "order": 16, + "visible": false, + "tileVisible": true + }, + { + "id": "achievements", + "order": 17, + "visible": true, + "tileVisible": false + }, + { + "id": "vo2Max", + "order": 18, + "visible": false, + "tileVisible": true + }, + { + "id": "recentWorkouts", + "order": 19, + "visible": true, + "tileVisible": true + }, + { + "id": "cardioRecovery", + "order": 20, + "visible": false, + "tileVisible": false + }, + { + "id": "sixMinuteWalk", + "order": 21, + "visible": false, + "tileVisible": false + }, + { + "id": "stairAscentSpeed", + "order": 22, + "visible": false, + "tileVisible": false + }, + { + "id": "stairDescentSpeed", + "order": 23, + "visible": false, + "tileVisible": false + }, + { + "id": "breathingDisturbances", + "order": 24, + "visible": false, + "tileVisible": false + }, + { + "id": "falls", + "order": 25, + "visible": false, + "tileVisible": false + }, + { + "id": "walkingSteadiness", + "order": 26, + "visible": false, + "tileVisible": false + }, + { + "id": "vorsorge", + "order": 27, + "visible": true, + "tileVisible": false + }, + { + "id": "waterIntake", + "order": 28, + "visible": false, + "tileVisible": true + } + ], + "heroRingOrder": [ + "HEALTH_SCORE", + "MED_COMPLIANCE" + ], + "chartOverlayPrefs": { + "weight": { + "rangePoints": 30, + "showTrendArrow": false, + "showTargetRange": true, + "comparisonBaseline": "none", + "showTrendIndicator": true + } + }, + "comparisonBaseline": "lastMonth", + "selectedScoreRings": [ + "MED_COMPLIANCE" + ], + "enabledHeroItemKinds": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/dashboard-widgets.04-put-partial-preserve.json.snap b/tests/integration/routes/parity/__snapshots__/dashboard-widgets.04-put-partial-preserve.json.snap new file mode 100644 index 000000000..47f2fd7d4 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/dashboard-widgets.04-put-partial-preserve.json.snap @@ -0,0 +1,428 @@ +{ + "status": 200, + "body": { + "data": { + "version": 1, + "widgets": [ + { + "id": "weight", + "order": 0, + "visible": true, + "tileVisible": true + }, + { + "id": "bp", + "order": 1, + "visible": true, + "tileVisible": true + }, + { + "id": "pulse", + "order": 2, + "visible": true, + "tileVisible": true + }, + { + "id": "hrv", + "order": 3, + "visible": false, + "tileVisible": true + }, + { + "id": "oxygenSaturation", + "order": 4, + "visible": false, + "tileVisible": true + }, + { + "id": "respiratoryRate", + "order": 5, + "visible": false, + "tileVisible": true + }, + { + "id": "wristTemperature", + "order": 6, + "visible": false, + "tileVisible": true + }, + { + "id": "bodyFat", + "order": 7, + "visible": true, + "tileVisible": true + }, + { + "id": "muscleMass", + "order": 8, + "visible": false, + "tileVisible": true + }, + { + "id": "totalBodyWater", + "order": 9, + "visible": false, + "tileVisible": true + }, + { + "id": "boneMass", + "order": 10, + "visible": false, + "tileVisible": true + }, + { + "id": "mood", + "order": 11, + "visible": true, + "tileVisible": true + }, + { + "id": "bpInTarget", + "order": 12, + "visible": true, + "tileVisible": true + }, + { + "id": "medications", + "order": 13, + "visible": true, + "tileVisible": true + }, + { + "id": "sleep", + "order": 14, + "visible": false, + "tileVisible": true + }, + { + "id": "steps", + "order": 15, + "visible": false, + "tileVisible": true + }, + { + "id": "glucose", + "order": 16, + "visible": false, + "tileVisible": true + }, + { + "id": "achievements", + "order": 17, + "visible": true, + "tileVisible": false + }, + { + "id": "vo2Max", + "order": 18, + "visible": false, + "tileVisible": true + }, + { + "id": "recentWorkouts", + "order": 19, + "visible": true, + "tileVisible": true + }, + { + "id": "cardioRecovery", + "order": 20, + "visible": false, + "tileVisible": false + }, + { + "id": "sixMinuteWalk", + "order": 21, + "visible": false, + "tileVisible": false + }, + { + "id": "stairAscentSpeed", + "order": 22, + "visible": false, + "tileVisible": false + }, + { + "id": "stairDescentSpeed", + "order": 23, + "visible": false, + "tileVisible": false + }, + { + "id": "breathingDisturbances", + "order": 24, + "visible": false, + "tileVisible": false + }, + { + "id": "falls", + "order": 25, + "visible": false, + "tileVisible": false + }, + { + "id": "walkingSteadiness", + "order": 26, + "visible": false, + "tileVisible": false + }, + { + "id": "vorsorge", + "order": 27, + "visible": true, + "tileVisible": false + }, + { + "id": "waterIntake", + "order": 28, + "visible": false, + "tileVisible": true + } + ], + "comparisonBaseline": "lastMonth", + "chartOverlayPrefs": { + "weight": { + "showTrendIndicator": false, + "showTrendArrow": true, + "showTargetRange": false, + "comparisonBaseline": "none", + "rangePoints": 30 + }, + "bp": { + "showTrendIndicator": true, + "showTrendArrow": true, + "showTargetRange": true, + "comparisonBaseline": "none" + } + }, + "selectedScoreRings": [ + "MED_COMPLIANCE" + ], + "heroRingOrder": [ + "HEALTH_SCORE", + "MED_COMPLIANCE" + ], + "enabledHeroItemKinds": [], + "hero": "reminders", + "updatedAt": "" + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "dashboard.widgets.update" + }, + "meta": { + "visible_count": 10 + }, + "warnings": null, + "error": null + } + ], + "stored": { + "hero": "reminders", + "version": 1, + "widgets": [ + { + "id": "weight", + "order": 0, + "visible": true, + "tileVisible": true + }, + { + "id": "bp", + "order": 1, + "visible": true, + "tileVisible": true + }, + { + "id": "pulse", + "order": 2, + "visible": true, + "tileVisible": true + }, + { + "id": "hrv", + "order": 3, + "visible": false, + "tileVisible": true + }, + { + "id": "oxygenSaturation", + "order": 4, + "visible": false, + "tileVisible": true + }, + { + "id": "respiratoryRate", + "order": 5, + "visible": false, + "tileVisible": true + }, + { + "id": "wristTemperature", + "order": 6, + "visible": false, + "tileVisible": true + }, + { + "id": "bodyFat", + "order": 7, + "visible": true, + "tileVisible": true + }, + { + "id": "muscleMass", + "order": 8, + "visible": false, + "tileVisible": true + }, + { + "id": "totalBodyWater", + "order": 9, + "visible": false, + "tileVisible": true + }, + { + "id": "boneMass", + "order": 10, + "visible": false, + "tileVisible": true + }, + { + "id": "mood", + "order": 11, + "visible": true, + "tileVisible": true + }, + { + "id": "bpInTarget", + "order": 12, + "visible": true, + "tileVisible": true + }, + { + "id": "medications", + "order": 13, + "visible": true, + "tileVisible": true + }, + { + "id": "sleep", + "order": 14, + "visible": false, + "tileVisible": true + }, + { + "id": "steps", + "order": 15, + "visible": false, + "tileVisible": true + }, + { + "id": "glucose", + "order": 16, + "visible": false, + "tileVisible": true + }, + { + "id": "achievements", + "order": 17, + "visible": true, + "tileVisible": false + }, + { + "id": "vo2Max", + "order": 18, + "visible": false, + "tileVisible": true + }, + { + "id": "recentWorkouts", + "order": 19, + "visible": true, + "tileVisible": true + }, + { + "id": "cardioRecovery", + "order": 20, + "visible": false, + "tileVisible": false + }, + { + "id": "sixMinuteWalk", + "order": 21, + "visible": false, + "tileVisible": false + }, + { + "id": "stairAscentSpeed", + "order": 22, + "visible": false, + "tileVisible": false + }, + { + "id": "stairDescentSpeed", + "order": 23, + "visible": false, + "tileVisible": false + }, + { + "id": "breathingDisturbances", + "order": 24, + "visible": false, + "tileVisible": false + }, + { + "id": "falls", + "order": 25, + "visible": false, + "tileVisible": false + }, + { + "id": "walkingSteadiness", + "order": 26, + "visible": false, + "tileVisible": false + }, + { + "id": "vorsorge", + "order": 27, + "visible": true, + "tileVisible": false + }, + { + "id": "waterIntake", + "order": 28, + "visible": false, + "tileVisible": true + } + ], + "heroRingOrder": [ + "HEALTH_SCORE", + "MED_COMPLIANCE" + ], + "chartOverlayPrefs": { + "bp": { + "showTrendArrow": true, + "showTargetRange": true, + "comparisonBaseline": "none", + "showTrendIndicator": true + }, + "weight": { + "rangePoints": 30, + "showTrendArrow": true, + "showTargetRange": false, + "comparisonBaseline": "none", + "showTrendIndicator": false + } + }, + "comparisonBaseline": "lastMonth", + "selectedScoreRings": [ + "MED_COMPLIANCE" + ], + "enabledHeroItemKinds": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/dashboard-widgets.05-put-invalid.json.snap b/tests/integration/routes/parity/__snapshots__/dashboard-widgets.05-put-invalid.json.snap new file mode 100644 index 000000000..881c7eea9 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/dashboard-widgets.05-put-invalid.json.snap @@ -0,0 +1,271 @@ +{ + "status": 422, + "body": { + "data": null, + "error": "Validation failed", + "details": { + "issues": [ + { + "path": "version", + "code": "invalid_value", + "message": "Invalid input: expected 1" + }, + { + "path": "widgets.0.visible", + "code": "invalid_type", + "message": "Invalid input: expected boolean, received string" + }, + { + "path": "comparisonBaseline", + "code": "invalid_value", + "message": "Invalid option: expected one of \"none\"|\"lastMonth\"|\"lastYear\"" + } + ] + }, + "meta": { + "errorCode": "http.invalid", + "requestId": "" + } + }, + "events": [ + { + "status": 422, + "action": { + "name": "dashboard.widgets.validation-failed" + }, + "meta": { + "issue_count": 3, + "received_keys": [ + "version", + "widgets", + "comparisonBaseline", + "password" + ], + "received_shape_excerpt": "{\"version\":2,\"widgets\":[{\"id\":\"weight\",\"visible\":\"yes\",\"order\":1}],\"comparisonBaseline\":\"lastDecade\",\"password\":\"[redacted]\"}", + "zod_issues": [ + { + "path": "version", + "code": "invalid_value", + "message": "Invalid input: expected 1" + }, + { + "path": "widgets.0.visible", + "code": "invalid_type", + "message": "Invalid input: expected boolean, received string" + }, + { + "path": "comparisonBaseline", + "code": "invalid_value", + "message": "Invalid option: expected one of \"none\"|\"lastMonth\"|\"lastYear\"" + } + ] + }, + "warnings": null, + "error": null + } + ], + "stored": { + "hero": "reminders", + "version": 1, + "widgets": [ + { + "id": "weight", + "order": 0, + "visible": true, + "tileVisible": true + }, + { + "id": "bp", + "order": 1, + "visible": true, + "tileVisible": true + }, + { + "id": "pulse", + "order": 2, + "visible": true, + "tileVisible": true + }, + { + "id": "hrv", + "order": 3, + "visible": false, + "tileVisible": true + }, + { + "id": "oxygenSaturation", + "order": 4, + "visible": false, + "tileVisible": true + }, + { + "id": "respiratoryRate", + "order": 5, + "visible": false, + "tileVisible": true + }, + { + "id": "wristTemperature", + "order": 6, + "visible": false, + "tileVisible": true + }, + { + "id": "bodyFat", + "order": 7, + "visible": true, + "tileVisible": true + }, + { + "id": "muscleMass", + "order": 8, + "visible": false, + "tileVisible": true + }, + { + "id": "totalBodyWater", + "order": 9, + "visible": false, + "tileVisible": true + }, + { + "id": "boneMass", + "order": 10, + "visible": false, + "tileVisible": true + }, + { + "id": "mood", + "order": 11, + "visible": true, + "tileVisible": true + }, + { + "id": "bpInTarget", + "order": 12, + "visible": true, + "tileVisible": true + }, + { + "id": "medications", + "order": 13, + "visible": true, + "tileVisible": true + }, + { + "id": "sleep", + "order": 14, + "visible": false, + "tileVisible": true + }, + { + "id": "steps", + "order": 15, + "visible": false, + "tileVisible": true + }, + { + "id": "glucose", + "order": 16, + "visible": false, + "tileVisible": true + }, + { + "id": "achievements", + "order": 17, + "visible": true, + "tileVisible": false + }, + { + "id": "vo2Max", + "order": 18, + "visible": false, + "tileVisible": true + }, + { + "id": "recentWorkouts", + "order": 19, + "visible": true, + "tileVisible": true + }, + { + "id": "cardioRecovery", + "order": 20, + "visible": false, + "tileVisible": false + }, + { + "id": "sixMinuteWalk", + "order": 21, + "visible": false, + "tileVisible": false + }, + { + "id": "stairAscentSpeed", + "order": 22, + "visible": false, + "tileVisible": false + }, + { + "id": "stairDescentSpeed", + "order": 23, + "visible": false, + "tileVisible": false + }, + { + "id": "breathingDisturbances", + "order": 24, + "visible": false, + "tileVisible": false + }, + { + "id": "falls", + "order": 25, + "visible": false, + "tileVisible": false + }, + { + "id": "walkingSteadiness", + "order": 26, + "visible": false, + "tileVisible": false + }, + { + "id": "vorsorge", + "order": 27, + "visible": true, + "tileVisible": false + }, + { + "id": "waterIntake", + "order": 28, + "visible": false, + "tileVisible": true + } + ], + "heroRingOrder": [ + "HEALTH_SCORE", + "MED_COMPLIANCE" + ], + "chartOverlayPrefs": { + "bp": { + "showTrendArrow": true, + "showTargetRange": true, + "comparisonBaseline": "none", + "showTrendIndicator": true + }, + "weight": { + "rangePoints": 30, + "showTrendArrow": true, + "showTargetRange": false, + "comparisonBaseline": "none", + "showTrendIndicator": false + } + }, + "comparisonBaseline": "lastMonth", + "selectedScoreRings": [ + "MED_COMPLIANCE" + ], + "enabledHeroItemKinds": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/dashboard-widgets.06-put-empty-body.json.snap b/tests/integration/routes/parity/__snapshots__/dashboard-widgets.06-put-empty-body.json.snap new file mode 100644 index 000000000..61d27e8c3 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/dashboard-widgets.06-put-empty-body.json.snap @@ -0,0 +1,224 @@ +{ + "status": 400, + "body": { + "data": null, + "error": "Invalid JSON body", + "meta": { + "errorCode": "http.bad_request", + "requestId": "" + } + }, + "events": [ + { + "status": 400, + "action": null, + "meta": null, + "warnings": null, + "error": null + } + ], + "stored": { + "hero": "reminders", + "version": 1, + "widgets": [ + { + "id": "weight", + "order": 0, + "visible": true, + "tileVisible": true + }, + { + "id": "bp", + "order": 1, + "visible": true, + "tileVisible": true + }, + { + "id": "pulse", + "order": 2, + "visible": true, + "tileVisible": true + }, + { + "id": "hrv", + "order": 3, + "visible": false, + "tileVisible": true + }, + { + "id": "oxygenSaturation", + "order": 4, + "visible": false, + "tileVisible": true + }, + { + "id": "respiratoryRate", + "order": 5, + "visible": false, + "tileVisible": true + }, + { + "id": "wristTemperature", + "order": 6, + "visible": false, + "tileVisible": true + }, + { + "id": "bodyFat", + "order": 7, + "visible": true, + "tileVisible": true + }, + { + "id": "muscleMass", + "order": 8, + "visible": false, + "tileVisible": true + }, + { + "id": "totalBodyWater", + "order": 9, + "visible": false, + "tileVisible": true + }, + { + "id": "boneMass", + "order": 10, + "visible": false, + "tileVisible": true + }, + { + "id": "mood", + "order": 11, + "visible": true, + "tileVisible": true + }, + { + "id": "bpInTarget", + "order": 12, + "visible": true, + "tileVisible": true + }, + { + "id": "medications", + "order": 13, + "visible": true, + "tileVisible": true + }, + { + "id": "sleep", + "order": 14, + "visible": false, + "tileVisible": true + }, + { + "id": "steps", + "order": 15, + "visible": false, + "tileVisible": true + }, + { + "id": "glucose", + "order": 16, + "visible": false, + "tileVisible": true + }, + { + "id": "achievements", + "order": 17, + "visible": true, + "tileVisible": false + }, + { + "id": "vo2Max", + "order": 18, + "visible": false, + "tileVisible": true + }, + { + "id": "recentWorkouts", + "order": 19, + "visible": true, + "tileVisible": true + }, + { + "id": "cardioRecovery", + "order": 20, + "visible": false, + "tileVisible": false + }, + { + "id": "sixMinuteWalk", + "order": 21, + "visible": false, + "tileVisible": false + }, + { + "id": "stairAscentSpeed", + "order": 22, + "visible": false, + "tileVisible": false + }, + { + "id": "stairDescentSpeed", + "order": 23, + "visible": false, + "tileVisible": false + }, + { + "id": "breathingDisturbances", + "order": 24, + "visible": false, + "tileVisible": false + }, + { + "id": "falls", + "order": 25, + "visible": false, + "tileVisible": false + }, + { + "id": "walkingSteadiness", + "order": 26, + "visible": false, + "tileVisible": false + }, + { + "id": "vorsorge", + "order": 27, + "visible": true, + "tileVisible": false + }, + { + "id": "waterIntake", + "order": 28, + "visible": false, + "tileVisible": true + } + ], + "heroRingOrder": [ + "HEALTH_SCORE", + "MED_COMPLIANCE" + ], + "chartOverlayPrefs": { + "bp": { + "showTrendArrow": true, + "showTargetRange": true, + "comparisonBaseline": "none", + "showTrendIndicator": true + }, + "weight": { + "rangePoints": 30, + "showTrendArrow": true, + "showTargetRange": false, + "comparisonBaseline": "none", + "showTrendIndicator": false + } + }, + "comparisonBaseline": "lastMonth", + "selectedScoreRings": [ + "MED_COMPLIANCE" + ], + "enabledHeroItemKinds": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/dashboard-widgets.07-put-invalid-base.json.snap b/tests/integration/routes/parity/__snapshots__/dashboard-widgets.07-put-invalid-base.json.snap new file mode 100644 index 000000000..ddfdb8515 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/dashboard-widgets.07-put-invalid-base.json.snap @@ -0,0 +1,224 @@ +{ + "status": 422, + "body": { + "data": null, + "error": "Invalid base token", + "meta": { + "errorCode": "invalid_base_updated_at", + "requestId": "" + } + }, + "events": [ + { + "status": 422, + "action": null, + "meta": null, + "warnings": null, + "error": null + } + ], + "stored": { + "hero": "reminders", + "version": 1, + "widgets": [ + { + "id": "weight", + "order": 0, + "visible": true, + "tileVisible": true + }, + { + "id": "bp", + "order": 1, + "visible": true, + "tileVisible": true + }, + { + "id": "pulse", + "order": 2, + "visible": true, + "tileVisible": true + }, + { + "id": "hrv", + "order": 3, + "visible": false, + "tileVisible": true + }, + { + "id": "oxygenSaturation", + "order": 4, + "visible": false, + "tileVisible": true + }, + { + "id": "respiratoryRate", + "order": 5, + "visible": false, + "tileVisible": true + }, + { + "id": "wristTemperature", + "order": 6, + "visible": false, + "tileVisible": true + }, + { + "id": "bodyFat", + "order": 7, + "visible": true, + "tileVisible": true + }, + { + "id": "muscleMass", + "order": 8, + "visible": false, + "tileVisible": true + }, + { + "id": "totalBodyWater", + "order": 9, + "visible": false, + "tileVisible": true + }, + { + "id": "boneMass", + "order": 10, + "visible": false, + "tileVisible": true + }, + { + "id": "mood", + "order": 11, + "visible": true, + "tileVisible": true + }, + { + "id": "bpInTarget", + "order": 12, + "visible": true, + "tileVisible": true + }, + { + "id": "medications", + "order": 13, + "visible": true, + "tileVisible": true + }, + { + "id": "sleep", + "order": 14, + "visible": false, + "tileVisible": true + }, + { + "id": "steps", + "order": 15, + "visible": false, + "tileVisible": true + }, + { + "id": "glucose", + "order": 16, + "visible": false, + "tileVisible": true + }, + { + "id": "achievements", + "order": 17, + "visible": true, + "tileVisible": false + }, + { + "id": "vo2Max", + "order": 18, + "visible": false, + "tileVisible": true + }, + { + "id": "recentWorkouts", + "order": 19, + "visible": true, + "tileVisible": true + }, + { + "id": "cardioRecovery", + "order": 20, + "visible": false, + "tileVisible": false + }, + { + "id": "sixMinuteWalk", + "order": 21, + "visible": false, + "tileVisible": false + }, + { + "id": "stairAscentSpeed", + "order": 22, + "visible": false, + "tileVisible": false + }, + { + "id": "stairDescentSpeed", + "order": 23, + "visible": false, + "tileVisible": false + }, + { + "id": "breathingDisturbances", + "order": 24, + "visible": false, + "tileVisible": false + }, + { + "id": "falls", + "order": 25, + "visible": false, + "tileVisible": false + }, + { + "id": "walkingSteadiness", + "order": 26, + "visible": false, + "tileVisible": false + }, + { + "id": "vorsorge", + "order": 27, + "visible": true, + "tileVisible": false + }, + { + "id": "waterIntake", + "order": 28, + "visible": false, + "tileVisible": true + } + ], + "heroRingOrder": [ + "HEALTH_SCORE", + "MED_COMPLIANCE" + ], + "chartOverlayPrefs": { + "bp": { + "showTrendArrow": true, + "showTargetRange": true, + "comparisonBaseline": "none", + "showTrendIndicator": true + }, + "weight": { + "rangePoints": 30, + "showTrendArrow": true, + "showTargetRange": false, + "comparisonBaseline": "none", + "showTrendIndicator": false + } + }, + "comparisonBaseline": "lastMonth", + "selectedScoreRings": [ + "MED_COMPLIANCE" + ], + "enabledHeroItemKinds": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/dashboard-widgets.08-put-stale-base.json.snap b/tests/integration/routes/parity/__snapshots__/dashboard-widgets.08-put-stale-base.json.snap new file mode 100644 index 000000000..1b7721ae9 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/dashboard-widgets.08-put-stale-base.json.snap @@ -0,0 +1,228 @@ +{ + "status": 409, + "body": { + "data": null, + "error": "Dashboard layout changed since it was loaded", + "meta": { + "errorCode": "dashboard_layout_conflict", + "requestId": "" + } + }, + "events": [ + { + "status": 409, + "action": { + "name": "dashboard.widgets.conflict" + }, + "meta": { + "base_updated_at": "2026-01-01T00:00:00.000Z" + }, + "warnings": null, + "error": null + } + ], + "stored": { + "hero": "reminders", + "version": 1, + "widgets": [ + { + "id": "weight", + "order": 0, + "visible": true, + "tileVisible": true + }, + { + "id": "bp", + "order": 1, + "visible": true, + "tileVisible": true + }, + { + "id": "pulse", + "order": 2, + "visible": true, + "tileVisible": true + }, + { + "id": "hrv", + "order": 3, + "visible": false, + "tileVisible": true + }, + { + "id": "oxygenSaturation", + "order": 4, + "visible": false, + "tileVisible": true + }, + { + "id": "respiratoryRate", + "order": 5, + "visible": false, + "tileVisible": true + }, + { + "id": "wristTemperature", + "order": 6, + "visible": false, + "tileVisible": true + }, + { + "id": "bodyFat", + "order": 7, + "visible": true, + "tileVisible": true + }, + { + "id": "muscleMass", + "order": 8, + "visible": false, + "tileVisible": true + }, + { + "id": "totalBodyWater", + "order": 9, + "visible": false, + "tileVisible": true + }, + { + "id": "boneMass", + "order": 10, + "visible": false, + "tileVisible": true + }, + { + "id": "mood", + "order": 11, + "visible": true, + "tileVisible": true + }, + { + "id": "bpInTarget", + "order": 12, + "visible": true, + "tileVisible": true + }, + { + "id": "medications", + "order": 13, + "visible": true, + "tileVisible": true + }, + { + "id": "sleep", + "order": 14, + "visible": false, + "tileVisible": true + }, + { + "id": "steps", + "order": 15, + "visible": false, + "tileVisible": true + }, + { + "id": "glucose", + "order": 16, + "visible": false, + "tileVisible": true + }, + { + "id": "achievements", + "order": 17, + "visible": true, + "tileVisible": false + }, + { + "id": "vo2Max", + "order": 18, + "visible": false, + "tileVisible": true + }, + { + "id": "recentWorkouts", + "order": 19, + "visible": true, + "tileVisible": true + }, + { + "id": "cardioRecovery", + "order": 20, + "visible": false, + "tileVisible": false + }, + { + "id": "sixMinuteWalk", + "order": 21, + "visible": false, + "tileVisible": false + }, + { + "id": "stairAscentSpeed", + "order": 22, + "visible": false, + "tileVisible": false + }, + { + "id": "stairDescentSpeed", + "order": 23, + "visible": false, + "tileVisible": false + }, + { + "id": "breathingDisturbances", + "order": 24, + "visible": false, + "tileVisible": false + }, + { + "id": "falls", + "order": 25, + "visible": false, + "tileVisible": false + }, + { + "id": "walkingSteadiness", + "order": 26, + "visible": false, + "tileVisible": false + }, + { + "id": "vorsorge", + "order": 27, + "visible": true, + "tileVisible": false + }, + { + "id": "waterIntake", + "order": 28, + "visible": false, + "tileVisible": true + } + ], + "heroRingOrder": [ + "HEALTH_SCORE", + "MED_COMPLIANCE" + ], + "chartOverlayPrefs": { + "bp": { + "showTrendArrow": true, + "showTargetRange": true, + "comparisonBaseline": "none", + "showTrendIndicator": true + }, + "weight": { + "rangePoints": 30, + "showTrendArrow": true, + "showTargetRange": false, + "comparisonBaseline": "none", + "showTrendIndicator": false + } + }, + "comparisonBaseline": "lastMonth", + "selectedScoreRings": [ + "MED_COMPLIANCE" + ], + "enabledHeroItemKinds": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/dashboard-widgets.09-put-current-base.json.snap b/tests/integration/routes/parity/__snapshots__/dashboard-widgets.09-put-current-base.json.snap new file mode 100644 index 000000000..7d089361e --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/dashboard-widgets.09-put-current-base.json.snap @@ -0,0 +1,430 @@ +{ + "status": 200, + "body": { + "data": { + "version": 1, + "widgets": [ + { + "id": "weight", + "order": 0, + "visible": true, + "tileVisible": true + }, + { + "id": "bp", + "order": 1, + "visible": true, + "tileVisible": true + }, + { + "id": "pulse", + "order": 2, + "visible": true, + "tileVisible": true + }, + { + "id": "hrv", + "order": 3, + "visible": false, + "tileVisible": true + }, + { + "id": "oxygenSaturation", + "order": 4, + "visible": false, + "tileVisible": true + }, + { + "id": "respiratoryRate", + "order": 5, + "visible": false, + "tileVisible": true + }, + { + "id": "wristTemperature", + "order": 6, + "visible": false, + "tileVisible": true + }, + { + "id": "bodyFat", + "order": 7, + "visible": true, + "tileVisible": true + }, + { + "id": "muscleMass", + "order": 8, + "visible": false, + "tileVisible": true + }, + { + "id": "totalBodyWater", + "order": 9, + "visible": false, + "tileVisible": true + }, + { + "id": "boneMass", + "order": 10, + "visible": false, + "tileVisible": true + }, + { + "id": "mood", + "order": 11, + "visible": true, + "tileVisible": true + }, + { + "id": "bpInTarget", + "order": 12, + "visible": true, + "tileVisible": true + }, + { + "id": "medications", + "order": 13, + "visible": true, + "tileVisible": true + }, + { + "id": "sleep", + "order": 14, + "visible": false, + "tileVisible": true + }, + { + "id": "steps", + "order": 15, + "visible": false, + "tileVisible": true + }, + { + "id": "glucose", + "order": 16, + "visible": false, + "tileVisible": true + }, + { + "id": "achievements", + "order": 17, + "visible": true, + "tileVisible": false + }, + { + "id": "vo2Max", + "order": 18, + "visible": false, + "tileVisible": true + }, + { + "id": "recentWorkouts", + "order": 19, + "visible": true, + "tileVisible": true + }, + { + "id": "cardioRecovery", + "order": 20, + "visible": false, + "tileVisible": false + }, + { + "id": "sixMinuteWalk", + "order": 21, + "visible": false, + "tileVisible": false + }, + { + "id": "stairAscentSpeed", + "order": 22, + "visible": false, + "tileVisible": false + }, + { + "id": "stairDescentSpeed", + "order": 23, + "visible": false, + "tileVisible": false + }, + { + "id": "breathingDisturbances", + "order": 24, + "visible": false, + "tileVisible": false + }, + { + "id": "falls", + "order": 25, + "visible": false, + "tileVisible": false + }, + { + "id": "walkingSteadiness", + "order": 26, + "visible": false, + "tileVisible": false + }, + { + "id": "vorsorge", + "order": 27, + "visible": true, + "tileVisible": false + }, + { + "id": "waterIntake", + "order": 28, + "visible": false, + "tileVisible": true + } + ], + "comparisonBaseline": "lastMonth", + "chartOverlayPrefs": { + "bp": { + "showTrendIndicator": true, + "showTrendArrow": true, + "showTargetRange": true, + "comparisonBaseline": "none" + }, + "weight": { + "showTrendIndicator": false, + "showTrendArrow": true, + "showTargetRange": false, + "comparisonBaseline": "none", + "rangePoints": 30 + } + }, + "selectedScoreRings": [ + "MED_COMPLIANCE" + ], + "heroRingOrder": [ + "HEALTH_SCORE", + "MED_COMPLIANCE" + ], + "enabledHeroItemKinds": [], + "hero": "reminders", + "todayCardVisible": false, + "updatedAt": "" + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "dashboard.widgets.update" + }, + "meta": { + "visible_count": 10 + }, + "warnings": null, + "error": null + } + ], + "stored": { + "hero": "reminders", + "version": 1, + "widgets": [ + { + "id": "weight", + "order": 0, + "visible": true, + "tileVisible": true + }, + { + "id": "bp", + "order": 1, + "visible": true, + "tileVisible": true + }, + { + "id": "pulse", + "order": 2, + "visible": true, + "tileVisible": true + }, + { + "id": "hrv", + "order": 3, + "visible": false, + "tileVisible": true + }, + { + "id": "oxygenSaturation", + "order": 4, + "visible": false, + "tileVisible": true + }, + { + "id": "respiratoryRate", + "order": 5, + "visible": false, + "tileVisible": true + }, + { + "id": "wristTemperature", + "order": 6, + "visible": false, + "tileVisible": true + }, + { + "id": "bodyFat", + "order": 7, + "visible": true, + "tileVisible": true + }, + { + "id": "muscleMass", + "order": 8, + "visible": false, + "tileVisible": true + }, + { + "id": "totalBodyWater", + "order": 9, + "visible": false, + "tileVisible": true + }, + { + "id": "boneMass", + "order": 10, + "visible": false, + "tileVisible": true + }, + { + "id": "mood", + "order": 11, + "visible": true, + "tileVisible": true + }, + { + "id": "bpInTarget", + "order": 12, + "visible": true, + "tileVisible": true + }, + { + "id": "medications", + "order": 13, + "visible": true, + "tileVisible": true + }, + { + "id": "sleep", + "order": 14, + "visible": false, + "tileVisible": true + }, + { + "id": "steps", + "order": 15, + "visible": false, + "tileVisible": true + }, + { + "id": "glucose", + "order": 16, + "visible": false, + "tileVisible": true + }, + { + "id": "achievements", + "order": 17, + "visible": true, + "tileVisible": false + }, + { + "id": "vo2Max", + "order": 18, + "visible": false, + "tileVisible": true + }, + { + "id": "recentWorkouts", + "order": 19, + "visible": true, + "tileVisible": true + }, + { + "id": "cardioRecovery", + "order": 20, + "visible": false, + "tileVisible": false + }, + { + "id": "sixMinuteWalk", + "order": 21, + "visible": false, + "tileVisible": false + }, + { + "id": "stairAscentSpeed", + "order": 22, + "visible": false, + "tileVisible": false + }, + { + "id": "stairDescentSpeed", + "order": 23, + "visible": false, + "tileVisible": false + }, + { + "id": "breathingDisturbances", + "order": 24, + "visible": false, + "tileVisible": false + }, + { + "id": "falls", + "order": 25, + "visible": false, + "tileVisible": false + }, + { + "id": "walkingSteadiness", + "order": 26, + "visible": false, + "tileVisible": false + }, + { + "id": "vorsorge", + "order": 27, + "visible": true, + "tileVisible": false + }, + { + "id": "waterIntake", + "order": 28, + "visible": false, + "tileVisible": true + } + ], + "heroRingOrder": [ + "HEALTH_SCORE", + "MED_COMPLIANCE" + ], + "todayCardVisible": false, + "chartOverlayPrefs": { + "bp": { + "showTrendArrow": true, + "showTargetRange": true, + "comparisonBaseline": "none", + "showTrendIndicator": true + }, + "weight": { + "rangePoints": 30, + "showTrendArrow": true, + "showTargetRange": false, + "comparisonBaseline": "none", + "showTrendIndicator": false + } + }, + "comparisonBaseline": "lastMonth", + "selectedScoreRings": [ + "MED_COMPLIANCE" + ], + "enabledHeroItemKinds": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/dashboard-widgets.10a-get-recovery-off-no-hrv.json.snap b/tests/integration/routes/parity/__snapshots__/dashboard-widgets.10a-get-recovery-off-no-hrv.json.snap new file mode 100644 index 000000000..d9f349889 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/dashboard-widgets.10a-get-recovery-off-no-hrv.json.snap @@ -0,0 +1,432 @@ +{ + "status": 200, + "body": { + "data": { + "version": 1, + "widgets": [ + { + "id": "weight", + "order": 0, + "visible": true, + "tileVisible": true + }, + { + "id": "bp", + "order": 1, + "visible": true, + "tileVisible": true + }, + { + "id": "pulse", + "order": 2, + "visible": true, + "tileVisible": true + }, + { + "id": "hrv", + "order": 3, + "visible": false, + "tileVisible": true + }, + { + "id": "oxygenSaturation", + "order": 4, + "visible": false, + "tileVisible": true + }, + { + "id": "respiratoryRate", + "order": 5, + "visible": false, + "tileVisible": true + }, + { + "id": "wristTemperature", + "order": 6, + "visible": false, + "tileVisible": true + }, + { + "id": "bodyFat", + "order": 7, + "visible": true, + "tileVisible": true + }, + { + "id": "muscleMass", + "order": 8, + "visible": false, + "tileVisible": true + }, + { + "id": "totalBodyWater", + "order": 9, + "visible": false, + "tileVisible": true + }, + { + "id": "boneMass", + "order": 10, + "visible": false, + "tileVisible": true + }, + { + "id": "mood", + "order": 11, + "visible": true, + "tileVisible": true + }, + { + "id": "bpInTarget", + "order": 12, + "visible": true, + "tileVisible": true + }, + { + "id": "medications", + "order": 13, + "visible": true, + "tileVisible": true + }, + { + "id": "sleep", + "order": 14, + "visible": false, + "tileVisible": true + }, + { + "id": "steps", + "order": 15, + "visible": false, + "tileVisible": true + }, + { + "id": "glucose", + "order": 16, + "visible": false, + "tileVisible": true + }, + { + "id": "achievements", + "order": 17, + "visible": true, + "tileVisible": false + }, + { + "id": "vo2Max", + "order": 18, + "visible": false, + "tileVisible": true + }, + { + "id": "recentWorkouts", + "order": 19, + "visible": true, + "tileVisible": true + }, + { + "id": "cardioRecovery", + "order": 20, + "visible": false, + "tileVisible": false + }, + { + "id": "sixMinuteWalk", + "order": 21, + "visible": false, + "tileVisible": false + }, + { + "id": "stairAscentSpeed", + "order": 22, + "visible": false, + "tileVisible": false + }, + { + "id": "stairDescentSpeed", + "order": 23, + "visible": false, + "tileVisible": false + }, + { + "id": "breathingDisturbances", + "order": 24, + "visible": false, + "tileVisible": false + }, + { + "id": "falls", + "order": 25, + "visible": false, + "tileVisible": false + }, + { + "id": "walkingSteadiness", + "order": 26, + "visible": false, + "tileVisible": false + }, + { + "id": "vorsorge", + "order": 27, + "visible": true, + "tileVisible": false + }, + { + "id": "waterIntake", + "order": 28, + "visible": false, + "tileVisible": true + } + ], + "comparisonBaseline": "lastMonth", + "chartOverlayPrefs": { + "bp": { + "showTrendIndicator": true, + "showTrendArrow": true, + "showTargetRange": true, + "comparisonBaseline": "none" + }, + "weight": { + "showTrendIndicator": false, + "showTrendArrow": true, + "showTargetRange": false, + "comparisonBaseline": "none", + "rangePoints": 30 + } + }, + "selectedScoreRings": [ + "MED_COMPLIANCE" + ], + "heroRingOrder": [ + "HEALTH_SCORE", + "MED_COMPLIANCE" + ], + "enabledHeroItemKinds": [], + "hero": "reminders", + "todayCardVisible": false, + "updatedAt": "", + "unavailableWidgetIds": [ + "hrv" + ] + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": null, + "meta": { + "cache.dashboardWidgets.outcome": "miss", + "cache.dashboardWidgets.key_hash": "" + }, + "warnings": null, + "error": null + } + ], + "stored": { + "hero": "reminders", + "version": 1, + "widgets": [ + { + "id": "weight", + "order": 0, + "visible": true, + "tileVisible": true + }, + { + "id": "bp", + "order": 1, + "visible": true, + "tileVisible": true + }, + { + "id": "pulse", + "order": 2, + "visible": true, + "tileVisible": true + }, + { + "id": "hrv", + "order": 3, + "visible": false, + "tileVisible": true + }, + { + "id": "oxygenSaturation", + "order": 4, + "visible": false, + "tileVisible": true + }, + { + "id": "respiratoryRate", + "order": 5, + "visible": false, + "tileVisible": true + }, + { + "id": "wristTemperature", + "order": 6, + "visible": false, + "tileVisible": true + }, + { + "id": "bodyFat", + "order": 7, + "visible": true, + "tileVisible": true + }, + { + "id": "muscleMass", + "order": 8, + "visible": false, + "tileVisible": true + }, + { + "id": "totalBodyWater", + "order": 9, + "visible": false, + "tileVisible": true + }, + { + "id": "boneMass", + "order": 10, + "visible": false, + "tileVisible": true + }, + { + "id": "mood", + "order": 11, + "visible": true, + "tileVisible": true + }, + { + "id": "bpInTarget", + "order": 12, + "visible": true, + "tileVisible": true + }, + { + "id": "medications", + "order": 13, + "visible": true, + "tileVisible": true + }, + { + "id": "sleep", + "order": 14, + "visible": false, + "tileVisible": true + }, + { + "id": "steps", + "order": 15, + "visible": false, + "tileVisible": true + }, + { + "id": "glucose", + "order": 16, + "visible": false, + "tileVisible": true + }, + { + "id": "achievements", + "order": 17, + "visible": true, + "tileVisible": false + }, + { + "id": "vo2Max", + "order": 18, + "visible": false, + "tileVisible": true + }, + { + "id": "recentWorkouts", + "order": 19, + "visible": true, + "tileVisible": true + }, + { + "id": "cardioRecovery", + "order": 20, + "visible": false, + "tileVisible": false + }, + { + "id": "sixMinuteWalk", + "order": 21, + "visible": false, + "tileVisible": false + }, + { + "id": "stairAscentSpeed", + "order": 22, + "visible": false, + "tileVisible": false + }, + { + "id": "stairDescentSpeed", + "order": 23, + "visible": false, + "tileVisible": false + }, + { + "id": "breathingDisturbances", + "order": 24, + "visible": false, + "tileVisible": false + }, + { + "id": "falls", + "order": 25, + "visible": false, + "tileVisible": false + }, + { + "id": "walkingSteadiness", + "order": 26, + "visible": false, + "tileVisible": false + }, + { + "id": "vorsorge", + "order": 27, + "visible": true, + "tileVisible": false + }, + { + "id": "waterIntake", + "order": 28, + "visible": false, + "tileVisible": true + } + ], + "heroRingOrder": [ + "HEALTH_SCORE", + "MED_COMPLIANCE" + ], + "todayCardVisible": false, + "chartOverlayPrefs": { + "bp": { + "showTrendArrow": true, + "showTargetRange": true, + "comparisonBaseline": "none", + "showTrendIndicator": true + }, + "weight": { + "rangePoints": 30, + "showTrendArrow": true, + "showTargetRange": false, + "comparisonBaseline": "none", + "showTrendIndicator": false + } + }, + "comparisonBaseline": "lastMonth", + "selectedScoreRings": [ + "MED_COMPLIANCE" + ], + "enabledHeroItemKinds": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/dashboard-widgets.10b-get-recovery-off-rmssd.json.snap b/tests/integration/routes/parity/__snapshots__/dashboard-widgets.10b-get-recovery-off-rmssd.json.snap new file mode 100644 index 000000000..71c833f1e --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/dashboard-widgets.10b-get-recovery-off-rmssd.json.snap @@ -0,0 +1,429 @@ +{ + "status": 200, + "body": { + "data": { + "version": 1, + "widgets": [ + { + "id": "weight", + "order": 0, + "visible": true, + "tileVisible": true + }, + { + "id": "bp", + "order": 1, + "visible": true, + "tileVisible": true + }, + { + "id": "pulse", + "order": 2, + "visible": true, + "tileVisible": true + }, + { + "id": "hrv", + "order": 3, + "visible": false, + "tileVisible": true + }, + { + "id": "oxygenSaturation", + "order": 4, + "visible": false, + "tileVisible": true + }, + { + "id": "respiratoryRate", + "order": 5, + "visible": false, + "tileVisible": true + }, + { + "id": "wristTemperature", + "order": 6, + "visible": false, + "tileVisible": true + }, + { + "id": "bodyFat", + "order": 7, + "visible": true, + "tileVisible": true + }, + { + "id": "muscleMass", + "order": 8, + "visible": false, + "tileVisible": true + }, + { + "id": "totalBodyWater", + "order": 9, + "visible": false, + "tileVisible": true + }, + { + "id": "boneMass", + "order": 10, + "visible": false, + "tileVisible": true + }, + { + "id": "mood", + "order": 11, + "visible": true, + "tileVisible": true + }, + { + "id": "bpInTarget", + "order": 12, + "visible": true, + "tileVisible": true + }, + { + "id": "medications", + "order": 13, + "visible": true, + "tileVisible": true + }, + { + "id": "sleep", + "order": 14, + "visible": false, + "tileVisible": true + }, + { + "id": "steps", + "order": 15, + "visible": false, + "tileVisible": true + }, + { + "id": "glucose", + "order": 16, + "visible": false, + "tileVisible": true + }, + { + "id": "achievements", + "order": 17, + "visible": true, + "tileVisible": false + }, + { + "id": "vo2Max", + "order": 18, + "visible": false, + "tileVisible": true + }, + { + "id": "recentWorkouts", + "order": 19, + "visible": true, + "tileVisible": true + }, + { + "id": "cardioRecovery", + "order": 20, + "visible": false, + "tileVisible": false + }, + { + "id": "sixMinuteWalk", + "order": 21, + "visible": false, + "tileVisible": false + }, + { + "id": "stairAscentSpeed", + "order": 22, + "visible": false, + "tileVisible": false + }, + { + "id": "stairDescentSpeed", + "order": 23, + "visible": false, + "tileVisible": false + }, + { + "id": "breathingDisturbances", + "order": 24, + "visible": false, + "tileVisible": false + }, + { + "id": "falls", + "order": 25, + "visible": false, + "tileVisible": false + }, + { + "id": "walkingSteadiness", + "order": 26, + "visible": false, + "tileVisible": false + }, + { + "id": "vorsorge", + "order": 27, + "visible": true, + "tileVisible": false + }, + { + "id": "waterIntake", + "order": 28, + "visible": false, + "tileVisible": true + } + ], + "comparisonBaseline": "lastMonth", + "chartOverlayPrefs": { + "bp": { + "showTrendIndicator": true, + "showTrendArrow": true, + "showTargetRange": true, + "comparisonBaseline": "none" + }, + "weight": { + "showTrendIndicator": false, + "showTrendArrow": true, + "showTargetRange": false, + "comparisonBaseline": "none", + "rangePoints": 30 + } + }, + "selectedScoreRings": [ + "MED_COMPLIANCE" + ], + "heroRingOrder": [ + "HEALTH_SCORE", + "MED_COMPLIANCE" + ], + "enabledHeroItemKinds": [], + "hero": "reminders", + "todayCardVisible": false, + "updatedAt": "" + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": null, + "meta": { + "cache.dashboardWidgets.outcome": "hit", + "cache.dashboardWidgets.key_hash": "" + }, + "warnings": null, + "error": null + } + ], + "stored": { + "hero": "reminders", + "version": 1, + "widgets": [ + { + "id": "weight", + "order": 0, + "visible": true, + "tileVisible": true + }, + { + "id": "bp", + "order": 1, + "visible": true, + "tileVisible": true + }, + { + "id": "pulse", + "order": 2, + "visible": true, + "tileVisible": true + }, + { + "id": "hrv", + "order": 3, + "visible": false, + "tileVisible": true + }, + { + "id": "oxygenSaturation", + "order": 4, + "visible": false, + "tileVisible": true + }, + { + "id": "respiratoryRate", + "order": 5, + "visible": false, + "tileVisible": true + }, + { + "id": "wristTemperature", + "order": 6, + "visible": false, + "tileVisible": true + }, + { + "id": "bodyFat", + "order": 7, + "visible": true, + "tileVisible": true + }, + { + "id": "muscleMass", + "order": 8, + "visible": false, + "tileVisible": true + }, + { + "id": "totalBodyWater", + "order": 9, + "visible": false, + "tileVisible": true + }, + { + "id": "boneMass", + "order": 10, + "visible": false, + "tileVisible": true + }, + { + "id": "mood", + "order": 11, + "visible": true, + "tileVisible": true + }, + { + "id": "bpInTarget", + "order": 12, + "visible": true, + "tileVisible": true + }, + { + "id": "medications", + "order": 13, + "visible": true, + "tileVisible": true + }, + { + "id": "sleep", + "order": 14, + "visible": false, + "tileVisible": true + }, + { + "id": "steps", + "order": 15, + "visible": false, + "tileVisible": true + }, + { + "id": "glucose", + "order": 16, + "visible": false, + "tileVisible": true + }, + { + "id": "achievements", + "order": 17, + "visible": true, + "tileVisible": false + }, + { + "id": "vo2Max", + "order": 18, + "visible": false, + "tileVisible": true + }, + { + "id": "recentWorkouts", + "order": 19, + "visible": true, + "tileVisible": true + }, + { + "id": "cardioRecovery", + "order": 20, + "visible": false, + "tileVisible": false + }, + { + "id": "sixMinuteWalk", + "order": 21, + "visible": false, + "tileVisible": false + }, + { + "id": "stairAscentSpeed", + "order": 22, + "visible": false, + "tileVisible": false + }, + { + "id": "stairDescentSpeed", + "order": 23, + "visible": false, + "tileVisible": false + }, + { + "id": "breathingDisturbances", + "order": 24, + "visible": false, + "tileVisible": false + }, + { + "id": "falls", + "order": 25, + "visible": false, + "tileVisible": false + }, + { + "id": "walkingSteadiness", + "order": 26, + "visible": false, + "tileVisible": false + }, + { + "id": "vorsorge", + "order": 27, + "visible": true, + "tileVisible": false + }, + { + "id": "waterIntake", + "order": 28, + "visible": false, + "tileVisible": true + } + ], + "heroRingOrder": [ + "HEALTH_SCORE", + "MED_COMPLIANCE" + ], + "todayCardVisible": false, + "chartOverlayPrefs": { + "bp": { + "showTrendArrow": true, + "showTargetRange": true, + "comparisonBaseline": "none", + "showTrendIndicator": true + }, + "weight": { + "rangePoints": 30, + "showTrendArrow": true, + "showTargetRange": false, + "comparisonBaseline": "none", + "showTrendIndicator": false + } + }, + "comparisonBaseline": "lastMonth", + "selectedScoreRings": [ + "MED_COMPLIANCE" + ], + "enabledHeroItemKinds": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/dashboard-widgets.11a-delegate-get.json.snap b/tests/integration/routes/parity/__snapshots__/dashboard-widgets.11a-delegate-get.json.snap new file mode 100644 index 000000000..71c833f1e --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/dashboard-widgets.11a-delegate-get.json.snap @@ -0,0 +1,429 @@ +{ + "status": 200, + "body": { + "data": { + "version": 1, + "widgets": [ + { + "id": "weight", + "order": 0, + "visible": true, + "tileVisible": true + }, + { + "id": "bp", + "order": 1, + "visible": true, + "tileVisible": true + }, + { + "id": "pulse", + "order": 2, + "visible": true, + "tileVisible": true + }, + { + "id": "hrv", + "order": 3, + "visible": false, + "tileVisible": true + }, + { + "id": "oxygenSaturation", + "order": 4, + "visible": false, + "tileVisible": true + }, + { + "id": "respiratoryRate", + "order": 5, + "visible": false, + "tileVisible": true + }, + { + "id": "wristTemperature", + "order": 6, + "visible": false, + "tileVisible": true + }, + { + "id": "bodyFat", + "order": 7, + "visible": true, + "tileVisible": true + }, + { + "id": "muscleMass", + "order": 8, + "visible": false, + "tileVisible": true + }, + { + "id": "totalBodyWater", + "order": 9, + "visible": false, + "tileVisible": true + }, + { + "id": "boneMass", + "order": 10, + "visible": false, + "tileVisible": true + }, + { + "id": "mood", + "order": 11, + "visible": true, + "tileVisible": true + }, + { + "id": "bpInTarget", + "order": 12, + "visible": true, + "tileVisible": true + }, + { + "id": "medications", + "order": 13, + "visible": true, + "tileVisible": true + }, + { + "id": "sleep", + "order": 14, + "visible": false, + "tileVisible": true + }, + { + "id": "steps", + "order": 15, + "visible": false, + "tileVisible": true + }, + { + "id": "glucose", + "order": 16, + "visible": false, + "tileVisible": true + }, + { + "id": "achievements", + "order": 17, + "visible": true, + "tileVisible": false + }, + { + "id": "vo2Max", + "order": 18, + "visible": false, + "tileVisible": true + }, + { + "id": "recentWorkouts", + "order": 19, + "visible": true, + "tileVisible": true + }, + { + "id": "cardioRecovery", + "order": 20, + "visible": false, + "tileVisible": false + }, + { + "id": "sixMinuteWalk", + "order": 21, + "visible": false, + "tileVisible": false + }, + { + "id": "stairAscentSpeed", + "order": 22, + "visible": false, + "tileVisible": false + }, + { + "id": "stairDescentSpeed", + "order": 23, + "visible": false, + "tileVisible": false + }, + { + "id": "breathingDisturbances", + "order": 24, + "visible": false, + "tileVisible": false + }, + { + "id": "falls", + "order": 25, + "visible": false, + "tileVisible": false + }, + { + "id": "walkingSteadiness", + "order": 26, + "visible": false, + "tileVisible": false + }, + { + "id": "vorsorge", + "order": 27, + "visible": true, + "tileVisible": false + }, + { + "id": "waterIntake", + "order": 28, + "visible": false, + "tileVisible": true + } + ], + "comparisonBaseline": "lastMonth", + "chartOverlayPrefs": { + "bp": { + "showTrendIndicator": true, + "showTrendArrow": true, + "showTargetRange": true, + "comparisonBaseline": "none" + }, + "weight": { + "showTrendIndicator": false, + "showTrendArrow": true, + "showTargetRange": false, + "comparisonBaseline": "none", + "rangePoints": 30 + } + }, + "selectedScoreRings": [ + "MED_COMPLIANCE" + ], + "heroRingOrder": [ + "HEALTH_SCORE", + "MED_COMPLIANCE" + ], + "enabledHeroItemKinds": [], + "hero": "reminders", + "todayCardVisible": false, + "updatedAt": "" + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": null, + "meta": { + "cache.dashboardWidgets.outcome": "hit", + "cache.dashboardWidgets.key_hash": "" + }, + "warnings": null, + "error": null + } + ], + "stored": { + "hero": "reminders", + "version": 1, + "widgets": [ + { + "id": "weight", + "order": 0, + "visible": true, + "tileVisible": true + }, + { + "id": "bp", + "order": 1, + "visible": true, + "tileVisible": true + }, + { + "id": "pulse", + "order": 2, + "visible": true, + "tileVisible": true + }, + { + "id": "hrv", + "order": 3, + "visible": false, + "tileVisible": true + }, + { + "id": "oxygenSaturation", + "order": 4, + "visible": false, + "tileVisible": true + }, + { + "id": "respiratoryRate", + "order": 5, + "visible": false, + "tileVisible": true + }, + { + "id": "wristTemperature", + "order": 6, + "visible": false, + "tileVisible": true + }, + { + "id": "bodyFat", + "order": 7, + "visible": true, + "tileVisible": true + }, + { + "id": "muscleMass", + "order": 8, + "visible": false, + "tileVisible": true + }, + { + "id": "totalBodyWater", + "order": 9, + "visible": false, + "tileVisible": true + }, + { + "id": "boneMass", + "order": 10, + "visible": false, + "tileVisible": true + }, + { + "id": "mood", + "order": 11, + "visible": true, + "tileVisible": true + }, + { + "id": "bpInTarget", + "order": 12, + "visible": true, + "tileVisible": true + }, + { + "id": "medications", + "order": 13, + "visible": true, + "tileVisible": true + }, + { + "id": "sleep", + "order": 14, + "visible": false, + "tileVisible": true + }, + { + "id": "steps", + "order": 15, + "visible": false, + "tileVisible": true + }, + { + "id": "glucose", + "order": 16, + "visible": false, + "tileVisible": true + }, + { + "id": "achievements", + "order": 17, + "visible": true, + "tileVisible": false + }, + { + "id": "vo2Max", + "order": 18, + "visible": false, + "tileVisible": true + }, + { + "id": "recentWorkouts", + "order": 19, + "visible": true, + "tileVisible": true + }, + { + "id": "cardioRecovery", + "order": 20, + "visible": false, + "tileVisible": false + }, + { + "id": "sixMinuteWalk", + "order": 21, + "visible": false, + "tileVisible": false + }, + { + "id": "stairAscentSpeed", + "order": 22, + "visible": false, + "tileVisible": false + }, + { + "id": "stairDescentSpeed", + "order": 23, + "visible": false, + "tileVisible": false + }, + { + "id": "breathingDisturbances", + "order": 24, + "visible": false, + "tileVisible": false + }, + { + "id": "falls", + "order": 25, + "visible": false, + "tileVisible": false + }, + { + "id": "walkingSteadiness", + "order": 26, + "visible": false, + "tileVisible": false + }, + { + "id": "vorsorge", + "order": 27, + "visible": true, + "tileVisible": false + }, + { + "id": "waterIntake", + "order": 28, + "visible": false, + "tileVisible": true + } + ], + "heroRingOrder": [ + "HEALTH_SCORE", + "MED_COMPLIANCE" + ], + "todayCardVisible": false, + "chartOverlayPrefs": { + "bp": { + "showTrendArrow": true, + "showTargetRange": true, + "comparisonBaseline": "none", + "showTrendIndicator": true + }, + "weight": { + "rangePoints": 30, + "showTrendArrow": true, + "showTargetRange": false, + "comparisonBaseline": "none", + "showTrendIndicator": false + } + }, + "comparisonBaseline": "lastMonth", + "selectedScoreRings": [ + "MED_COMPLIANCE" + ], + "enabledHeroItemKinds": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/dashboard-widgets.11b-delegate-put.json.snap b/tests/integration/routes/parity/__snapshots__/dashboard-widgets.11b-delegate-put.json.snap new file mode 100644 index 000000000..b241397e8 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/dashboard-widgets.11b-delegate-put.json.snap @@ -0,0 +1,230 @@ +{ + "status": 403, + "body": { + "data": null, + "error": "This endpoint cannot be used while acting on another account", + "meta": { + "errorCode": "sharing.not_permitted", + "requestId": "" + } + }, + "events": [ + { + "status": 403, + "action": null, + "meta": { + "sharing_refusal": "undeclared_mode" + }, + "warnings": null, + "error": { + "type": "SharingNotPermittedError", + "message": "This endpoint cannot be used while acting on another account" + } + } + ], + "stored": { + "hero": "reminders", + "version": 1, + "widgets": [ + { + "id": "weight", + "order": 0, + "visible": true, + "tileVisible": true + }, + { + "id": "bp", + "order": 1, + "visible": true, + "tileVisible": true + }, + { + "id": "pulse", + "order": 2, + "visible": true, + "tileVisible": true + }, + { + "id": "hrv", + "order": 3, + "visible": false, + "tileVisible": true + }, + { + "id": "oxygenSaturation", + "order": 4, + "visible": false, + "tileVisible": true + }, + { + "id": "respiratoryRate", + "order": 5, + "visible": false, + "tileVisible": true + }, + { + "id": "wristTemperature", + "order": 6, + "visible": false, + "tileVisible": true + }, + { + "id": "bodyFat", + "order": 7, + "visible": true, + "tileVisible": true + }, + { + "id": "muscleMass", + "order": 8, + "visible": false, + "tileVisible": true + }, + { + "id": "totalBodyWater", + "order": 9, + "visible": false, + "tileVisible": true + }, + { + "id": "boneMass", + "order": 10, + "visible": false, + "tileVisible": true + }, + { + "id": "mood", + "order": 11, + "visible": true, + "tileVisible": true + }, + { + "id": "bpInTarget", + "order": 12, + "visible": true, + "tileVisible": true + }, + { + "id": "medications", + "order": 13, + "visible": true, + "tileVisible": true + }, + { + "id": "sleep", + "order": 14, + "visible": false, + "tileVisible": true + }, + { + "id": "steps", + "order": 15, + "visible": false, + "tileVisible": true + }, + { + "id": "glucose", + "order": 16, + "visible": false, + "tileVisible": true + }, + { + "id": "achievements", + "order": 17, + "visible": true, + "tileVisible": false + }, + { + "id": "vo2Max", + "order": 18, + "visible": false, + "tileVisible": true + }, + { + "id": "recentWorkouts", + "order": 19, + "visible": true, + "tileVisible": true + }, + { + "id": "cardioRecovery", + "order": 20, + "visible": false, + "tileVisible": false + }, + { + "id": "sixMinuteWalk", + "order": 21, + "visible": false, + "tileVisible": false + }, + { + "id": "stairAscentSpeed", + "order": 22, + "visible": false, + "tileVisible": false + }, + { + "id": "stairDescentSpeed", + "order": 23, + "visible": false, + "tileVisible": false + }, + { + "id": "breathingDisturbances", + "order": 24, + "visible": false, + "tileVisible": false + }, + { + "id": "falls", + "order": 25, + "visible": false, + "tileVisible": false + }, + { + "id": "walkingSteadiness", + "order": 26, + "visible": false, + "tileVisible": false + }, + { + "id": "vorsorge", + "order": 27, + "visible": true, + "tileVisible": false + }, + { + "id": "waterIntake", + "order": 28, + "visible": false, + "tileVisible": true + } + ], + "heroRingOrder": [ + "HEALTH_SCORE", + "MED_COMPLIANCE" + ], + "todayCardVisible": false, + "chartOverlayPrefs": { + "bp": { + "showTrendArrow": true, + "showTargetRange": true, + "comparisonBaseline": "none", + "showTrendIndicator": true + }, + "weight": { + "rangePoints": 30, + "showTrendArrow": true, + "showTargetRange": false, + "comparisonBaseline": "none", + "showTrendIndicator": false + } + }, + "comparisonBaseline": "lastMonth", + "selectedScoreRings": [ + "MED_COMPLIANCE" + ], + "enabledHeroItemKinds": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/dashboard-widgets.11c-delegate-delete.json.snap b/tests/integration/routes/parity/__snapshots__/dashboard-widgets.11c-delegate-delete.json.snap new file mode 100644 index 000000000..b241397e8 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/dashboard-widgets.11c-delegate-delete.json.snap @@ -0,0 +1,230 @@ +{ + "status": 403, + "body": { + "data": null, + "error": "This endpoint cannot be used while acting on another account", + "meta": { + "errorCode": "sharing.not_permitted", + "requestId": "" + } + }, + "events": [ + { + "status": 403, + "action": null, + "meta": { + "sharing_refusal": "undeclared_mode" + }, + "warnings": null, + "error": { + "type": "SharingNotPermittedError", + "message": "This endpoint cannot be used while acting on another account" + } + } + ], + "stored": { + "hero": "reminders", + "version": 1, + "widgets": [ + { + "id": "weight", + "order": 0, + "visible": true, + "tileVisible": true + }, + { + "id": "bp", + "order": 1, + "visible": true, + "tileVisible": true + }, + { + "id": "pulse", + "order": 2, + "visible": true, + "tileVisible": true + }, + { + "id": "hrv", + "order": 3, + "visible": false, + "tileVisible": true + }, + { + "id": "oxygenSaturation", + "order": 4, + "visible": false, + "tileVisible": true + }, + { + "id": "respiratoryRate", + "order": 5, + "visible": false, + "tileVisible": true + }, + { + "id": "wristTemperature", + "order": 6, + "visible": false, + "tileVisible": true + }, + { + "id": "bodyFat", + "order": 7, + "visible": true, + "tileVisible": true + }, + { + "id": "muscleMass", + "order": 8, + "visible": false, + "tileVisible": true + }, + { + "id": "totalBodyWater", + "order": 9, + "visible": false, + "tileVisible": true + }, + { + "id": "boneMass", + "order": 10, + "visible": false, + "tileVisible": true + }, + { + "id": "mood", + "order": 11, + "visible": true, + "tileVisible": true + }, + { + "id": "bpInTarget", + "order": 12, + "visible": true, + "tileVisible": true + }, + { + "id": "medications", + "order": 13, + "visible": true, + "tileVisible": true + }, + { + "id": "sleep", + "order": 14, + "visible": false, + "tileVisible": true + }, + { + "id": "steps", + "order": 15, + "visible": false, + "tileVisible": true + }, + { + "id": "glucose", + "order": 16, + "visible": false, + "tileVisible": true + }, + { + "id": "achievements", + "order": 17, + "visible": true, + "tileVisible": false + }, + { + "id": "vo2Max", + "order": 18, + "visible": false, + "tileVisible": true + }, + { + "id": "recentWorkouts", + "order": 19, + "visible": true, + "tileVisible": true + }, + { + "id": "cardioRecovery", + "order": 20, + "visible": false, + "tileVisible": false + }, + { + "id": "sixMinuteWalk", + "order": 21, + "visible": false, + "tileVisible": false + }, + { + "id": "stairAscentSpeed", + "order": 22, + "visible": false, + "tileVisible": false + }, + { + "id": "stairDescentSpeed", + "order": 23, + "visible": false, + "tileVisible": false + }, + { + "id": "breathingDisturbances", + "order": 24, + "visible": false, + "tileVisible": false + }, + { + "id": "falls", + "order": 25, + "visible": false, + "tileVisible": false + }, + { + "id": "walkingSteadiness", + "order": 26, + "visible": false, + "tileVisible": false + }, + { + "id": "vorsorge", + "order": 27, + "visible": true, + "tileVisible": false + }, + { + "id": "waterIntake", + "order": 28, + "visible": false, + "tileVisible": true + } + ], + "heroRingOrder": [ + "HEALTH_SCORE", + "MED_COMPLIANCE" + ], + "todayCardVisible": false, + "chartOverlayPrefs": { + "bp": { + "showTrendArrow": true, + "showTargetRange": true, + "comparisonBaseline": "none", + "showTrendIndicator": true + }, + "weight": { + "rangePoints": 30, + "showTrendArrow": true, + "showTargetRange": false, + "comparisonBaseline": "none", + "showTrendIndicator": false + } + }, + "comparisonBaseline": "lastMonth", + "selectedScoreRings": [ + "MED_COMPLIANCE" + ], + "enabledHeroItemKinds": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/dashboard-widgets.12-delete-reset.json.snap b/tests/integration/routes/parity/__snapshots__/dashboard-widgets.12-delete-reset.json.snap new file mode 100644 index 000000000..74d9a52b9 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/dashboard-widgets.12-delete-reset.json.snap @@ -0,0 +1,436 @@ +{ + "status": 200, + "body": { + "data": { + "version": 1, + "widgets": [ + { + "id": "weight", + "visible": true, + "tileVisible": true, + "order": 0 + }, + { + "id": "bp", + "visible": true, + "tileVisible": true, + "order": 1 + }, + { + "id": "pulse", + "visible": true, + "tileVisible": true, + "order": 2 + }, + { + "id": "hrv", + "visible": false, + "tileVisible": true, + "order": 3 + }, + { + "id": "oxygenSaturation", + "visible": false, + "tileVisible": true, + "order": 4 + }, + { + "id": "respiratoryRate", + "visible": false, + "tileVisible": true, + "order": 5 + }, + { + "id": "wristTemperature", + "visible": false, + "tileVisible": true, + "order": 6 + }, + { + "id": "bodyFat", + "visible": true, + "tileVisible": true, + "order": 7 + }, + { + "id": "muscleMass", + "visible": false, + "tileVisible": true, + "order": 8 + }, + { + "id": "totalBodyWater", + "visible": false, + "tileVisible": true, + "order": 9 + }, + { + "id": "boneMass", + "visible": false, + "tileVisible": true, + "order": 10 + }, + { + "id": "mood", + "visible": true, + "tileVisible": true, + "order": 11 + }, + { + "id": "bpInTarget", + "visible": true, + "tileVisible": true, + "order": 12 + }, + { + "id": "medications", + "visible": true, + "tileVisible": true, + "order": 13 + }, + { + "id": "sleep", + "visible": false, + "tileVisible": true, + "order": 14 + }, + { + "id": "steps", + "visible": false, + "tileVisible": true, + "order": 15 + }, + { + "id": "glucose", + "visible": false, + "tileVisible": true, + "order": 16 + }, + { + "id": "achievements", + "visible": true, + "tileVisible": false, + "order": 17 + }, + { + "id": "vo2Max", + "visible": false, + "tileVisible": true, + "order": 18 + }, + { + "id": "recentWorkouts", + "visible": true, + "tileVisible": true, + "order": 19 + }, + { + "id": "cardioRecovery", + "visible": false, + "tileVisible": false, + "order": 20 + }, + { + "id": "sixMinuteWalk", + "visible": false, + "tileVisible": false, + "order": 21 + }, + { + "id": "stairAscentSpeed", + "visible": false, + "tileVisible": false, + "order": 22 + }, + { + "id": "stairDescentSpeed", + "visible": false, + "tileVisible": false, + "order": 23 + }, + { + "id": "breathingDisturbances", + "visible": false, + "tileVisible": false, + "order": 24 + }, + { + "id": "falls", + "visible": false, + "tileVisible": false, + "order": 25 + }, + { + "id": "walkingSteadiness", + "visible": false, + "tileVisible": false, + "order": 26 + }, + { + "id": "vorsorge", + "visible": true, + "tileVisible": false, + "order": 27 + }, + { + "id": "waterIntake", + "visible": false, + "tileVisible": true, + "order": 28 + } + ], + "comparisonBaseline": "lastMonth", + "chartOverlayPrefs": { + "bp": { + "showTrendIndicator": true, + "showTrendArrow": true, + "showTargetRange": true, + "comparisonBaseline": "none" + }, + "weight": { + "showTrendIndicator": false, + "showTrendArrow": true, + "showTargetRange": false, + "comparisonBaseline": "none", + "rangePoints": 30 + } + }, + "selectedScoreRings": [ + "MED_COMPLIANCE" + ], + "heroRingOrder": [ + "HEALTH_SCORE", + "MED_COMPLIANCE" + ], + "enabledHeroItemKinds": [ + "coach_checkin", + "dose_window", + "preventive_care", + "sync_issue", + "milestone", + "ecg_new_recording", + "tension_window", + "same_time_baseline", + "upcoming_visit" + ], + "hero": "reminders", + "todayCardVisible": true, + "updatedAt": "" + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "dashboard.widgets.reset" + }, + "meta": null, + "warnings": null, + "error": null + } + ], + "stored": { + "hero": "reminders", + "version": 1, + "widgets": [ + { + "id": "weight", + "order": 0, + "visible": true, + "tileVisible": true + }, + { + "id": "bp", + "order": 1, + "visible": true, + "tileVisible": true + }, + { + "id": "pulse", + "order": 2, + "visible": true, + "tileVisible": true + }, + { + "id": "hrv", + "order": 3, + "visible": false, + "tileVisible": true + }, + { + "id": "oxygenSaturation", + "order": 4, + "visible": false, + "tileVisible": true + }, + { + "id": "respiratoryRate", + "order": 5, + "visible": false, + "tileVisible": true + }, + { + "id": "wristTemperature", + "order": 6, + "visible": false, + "tileVisible": true + }, + { + "id": "bodyFat", + "order": 7, + "visible": true, + "tileVisible": true + }, + { + "id": "muscleMass", + "order": 8, + "visible": false, + "tileVisible": true + }, + { + "id": "totalBodyWater", + "order": 9, + "visible": false, + "tileVisible": true + }, + { + "id": "boneMass", + "order": 10, + "visible": false, + "tileVisible": true + }, + { + "id": "mood", + "order": 11, + "visible": true, + "tileVisible": true + }, + { + "id": "bpInTarget", + "order": 12, + "visible": true, + "tileVisible": true + }, + { + "id": "medications", + "order": 13, + "visible": true, + "tileVisible": true + }, + { + "id": "sleep", + "order": 14, + "visible": false, + "tileVisible": true + }, + { + "id": "steps", + "order": 15, + "visible": false, + "tileVisible": true + }, + { + "id": "glucose", + "order": 16, + "visible": false, + "tileVisible": true + }, + { + "id": "achievements", + "order": 17, + "visible": true, + "tileVisible": false + }, + { + "id": "vo2Max", + "order": 18, + "visible": false, + "tileVisible": true + }, + { + "id": "recentWorkouts", + "order": 19, + "visible": true, + "tileVisible": true + }, + { + "id": "cardioRecovery", + "order": 20, + "visible": false, + "tileVisible": false + }, + { + "id": "sixMinuteWalk", + "order": 21, + "visible": false, + "tileVisible": false + }, + { + "id": "stairAscentSpeed", + "order": 22, + "visible": false, + "tileVisible": false + }, + { + "id": "stairDescentSpeed", + "order": 23, + "visible": false, + "tileVisible": false + }, + { + "id": "breathingDisturbances", + "order": 24, + "visible": false, + "tileVisible": false + }, + { + "id": "falls", + "order": 25, + "visible": false, + "tileVisible": false + }, + { + "id": "walkingSteadiness", + "order": 26, + "visible": false, + "tileVisible": false + }, + { + "id": "vorsorge", + "order": 27, + "visible": true, + "tileVisible": false + }, + { + "id": "waterIntake", + "order": 28, + "visible": false, + "tileVisible": true + } + ], + "heroRingOrder": [ + "HEALTH_SCORE", + "MED_COMPLIANCE" + ], + "chartOverlayPrefs": { + "bp": { + "showTrendArrow": true, + "showTargetRange": true, + "comparisonBaseline": "none", + "showTrendIndicator": true + }, + "weight": { + "rangePoints": 30, + "showTrendArrow": true, + "showTargetRange": false, + "comparisonBaseline": "none", + "showTrendIndicator": false + } + }, + "comparisonBaseline": "lastMonth", + "selectedScoreRings": [ + "MED_COMPLIANCE" + ] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/dashboard-widgets.13-get-after-reset.json.snap b/tests/integration/routes/parity/__snapshots__/dashboard-widgets.13-get-after-reset.json.snap new file mode 100644 index 000000000..e2b329bf3 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/dashboard-widgets.13-get-after-reset.json.snap @@ -0,0 +1,437 @@ +{ + "status": 200, + "body": { + "data": { + "version": 1, + "widgets": [ + { + "id": "weight", + "order": 0, + "visible": true, + "tileVisible": true + }, + { + "id": "bp", + "order": 1, + "visible": true, + "tileVisible": true + }, + { + "id": "pulse", + "order": 2, + "visible": true, + "tileVisible": true + }, + { + "id": "hrv", + "order": 3, + "visible": false, + "tileVisible": true + }, + { + "id": "oxygenSaturation", + "order": 4, + "visible": false, + "tileVisible": true + }, + { + "id": "respiratoryRate", + "order": 5, + "visible": false, + "tileVisible": true + }, + { + "id": "wristTemperature", + "order": 6, + "visible": false, + "tileVisible": true + }, + { + "id": "bodyFat", + "order": 7, + "visible": true, + "tileVisible": true + }, + { + "id": "muscleMass", + "order": 8, + "visible": false, + "tileVisible": true + }, + { + "id": "totalBodyWater", + "order": 9, + "visible": false, + "tileVisible": true + }, + { + "id": "boneMass", + "order": 10, + "visible": false, + "tileVisible": true + }, + { + "id": "mood", + "order": 11, + "visible": true, + "tileVisible": true + }, + { + "id": "bpInTarget", + "order": 12, + "visible": true, + "tileVisible": true + }, + { + "id": "medications", + "order": 13, + "visible": true, + "tileVisible": true + }, + { + "id": "sleep", + "order": 14, + "visible": false, + "tileVisible": true + }, + { + "id": "steps", + "order": 15, + "visible": false, + "tileVisible": true + }, + { + "id": "glucose", + "order": 16, + "visible": false, + "tileVisible": true + }, + { + "id": "achievements", + "order": 17, + "visible": true, + "tileVisible": false + }, + { + "id": "vo2Max", + "order": 18, + "visible": false, + "tileVisible": true + }, + { + "id": "recentWorkouts", + "order": 19, + "visible": true, + "tileVisible": true + }, + { + "id": "cardioRecovery", + "order": 20, + "visible": false, + "tileVisible": false + }, + { + "id": "sixMinuteWalk", + "order": 21, + "visible": false, + "tileVisible": false + }, + { + "id": "stairAscentSpeed", + "order": 22, + "visible": false, + "tileVisible": false + }, + { + "id": "stairDescentSpeed", + "order": 23, + "visible": false, + "tileVisible": false + }, + { + "id": "breathingDisturbances", + "order": 24, + "visible": false, + "tileVisible": false + }, + { + "id": "falls", + "order": 25, + "visible": false, + "tileVisible": false + }, + { + "id": "walkingSteadiness", + "order": 26, + "visible": false, + "tileVisible": false + }, + { + "id": "vorsorge", + "order": 27, + "visible": true, + "tileVisible": false + }, + { + "id": "waterIntake", + "order": 28, + "visible": false, + "tileVisible": true + } + ], + "comparisonBaseline": "lastMonth", + "chartOverlayPrefs": { + "bp": { + "showTrendIndicator": true, + "showTrendArrow": true, + "showTargetRange": true, + "comparisonBaseline": "none" + }, + "weight": { + "showTrendIndicator": false, + "showTrendArrow": true, + "showTargetRange": false, + "comparisonBaseline": "none", + "rangePoints": 30 + } + }, + "selectedScoreRings": [ + "MED_COMPLIANCE" + ], + "heroRingOrder": [ + "HEALTH_SCORE", + "MED_COMPLIANCE" + ], + "enabledHeroItemKinds": [ + "coach_checkin", + "dose_window", + "preventive_care", + "sync_issue", + "milestone", + "ecg_new_recording", + "tension_window", + "same_time_baseline", + "upcoming_visit" + ], + "hero": "reminders", + "todayCardVisible": true, + "updatedAt": "" + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": null, + "meta": { + "cache.dashboardWidgets.outcome": "miss", + "cache.dashboardWidgets.key_hash": "" + }, + "warnings": null, + "error": null + } + ], + "stored": { + "hero": "reminders", + "version": 1, + "widgets": [ + { + "id": "weight", + "order": 0, + "visible": true, + "tileVisible": true + }, + { + "id": "bp", + "order": 1, + "visible": true, + "tileVisible": true + }, + { + "id": "pulse", + "order": 2, + "visible": true, + "tileVisible": true + }, + { + "id": "hrv", + "order": 3, + "visible": false, + "tileVisible": true + }, + { + "id": "oxygenSaturation", + "order": 4, + "visible": false, + "tileVisible": true + }, + { + "id": "respiratoryRate", + "order": 5, + "visible": false, + "tileVisible": true + }, + { + "id": "wristTemperature", + "order": 6, + "visible": false, + "tileVisible": true + }, + { + "id": "bodyFat", + "order": 7, + "visible": true, + "tileVisible": true + }, + { + "id": "muscleMass", + "order": 8, + "visible": false, + "tileVisible": true + }, + { + "id": "totalBodyWater", + "order": 9, + "visible": false, + "tileVisible": true + }, + { + "id": "boneMass", + "order": 10, + "visible": false, + "tileVisible": true + }, + { + "id": "mood", + "order": 11, + "visible": true, + "tileVisible": true + }, + { + "id": "bpInTarget", + "order": 12, + "visible": true, + "tileVisible": true + }, + { + "id": "medications", + "order": 13, + "visible": true, + "tileVisible": true + }, + { + "id": "sleep", + "order": 14, + "visible": false, + "tileVisible": true + }, + { + "id": "steps", + "order": 15, + "visible": false, + "tileVisible": true + }, + { + "id": "glucose", + "order": 16, + "visible": false, + "tileVisible": true + }, + { + "id": "achievements", + "order": 17, + "visible": true, + "tileVisible": false + }, + { + "id": "vo2Max", + "order": 18, + "visible": false, + "tileVisible": true + }, + { + "id": "recentWorkouts", + "order": 19, + "visible": true, + "tileVisible": true + }, + { + "id": "cardioRecovery", + "order": 20, + "visible": false, + "tileVisible": false + }, + { + "id": "sixMinuteWalk", + "order": 21, + "visible": false, + "tileVisible": false + }, + { + "id": "stairAscentSpeed", + "order": 22, + "visible": false, + "tileVisible": false + }, + { + "id": "stairDescentSpeed", + "order": 23, + "visible": false, + "tileVisible": false + }, + { + "id": "breathingDisturbances", + "order": 24, + "visible": false, + "tileVisible": false + }, + { + "id": "falls", + "order": 25, + "visible": false, + "tileVisible": false + }, + { + "id": "walkingSteadiness", + "order": 26, + "visible": false, + "tileVisible": false + }, + { + "id": "vorsorge", + "order": 27, + "visible": true, + "tileVisible": false + }, + { + "id": "waterIntake", + "order": 28, + "visible": false, + "tileVisible": true + } + ], + "heroRingOrder": [ + "HEALTH_SCORE", + "MED_COMPLIANCE" + ], + "chartOverlayPrefs": { + "bp": { + "showTrendArrow": true, + "showTargetRange": true, + "comparisonBaseline": "none", + "showTrendIndicator": true + }, + "weight": { + "rangePoints": 30, + "showTrendArrow": true, + "showTargetRange": false, + "comparisonBaseline": "none", + "showTrendIndicator": false + } + }, + "comparisonBaseline": "lastMonth", + "selectedScoreRings": [ + "MED_COMPLIANCE" + ] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/dashboard-widgets.14-anonymous-get.json.snap b/tests/integration/routes/parity/__snapshots__/dashboard-widgets.14-anonymous-get.json.snap new file mode 100644 index 000000000..83ae725b0 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/dashboard-widgets.14-anonymous-get.json.snap @@ -0,0 +1,226 @@ +{ + "status": 401, + "body": { + "data": null, + "error": "Not authenticated", + "meta": { + "errorCode": "auth.missing", + "requestId": "" + } + }, + "events": [ + { + "status": 401, + "action": null, + "meta": null, + "warnings": null, + "error": { + "type": "HttpError", + "message": "Not authenticated" + } + } + ], + "stored": { + "hero": "reminders", + "version": 1, + "widgets": [ + { + "id": "weight", + "order": 0, + "visible": true, + "tileVisible": true + }, + { + "id": "bp", + "order": 1, + "visible": true, + "tileVisible": true + }, + { + "id": "pulse", + "order": 2, + "visible": true, + "tileVisible": true + }, + { + "id": "hrv", + "order": 3, + "visible": false, + "tileVisible": true + }, + { + "id": "oxygenSaturation", + "order": 4, + "visible": false, + "tileVisible": true + }, + { + "id": "respiratoryRate", + "order": 5, + "visible": false, + "tileVisible": true + }, + { + "id": "wristTemperature", + "order": 6, + "visible": false, + "tileVisible": true + }, + { + "id": "bodyFat", + "order": 7, + "visible": true, + "tileVisible": true + }, + { + "id": "muscleMass", + "order": 8, + "visible": false, + "tileVisible": true + }, + { + "id": "totalBodyWater", + "order": 9, + "visible": false, + "tileVisible": true + }, + { + "id": "boneMass", + "order": 10, + "visible": false, + "tileVisible": true + }, + { + "id": "mood", + "order": 11, + "visible": true, + "tileVisible": true + }, + { + "id": "bpInTarget", + "order": 12, + "visible": true, + "tileVisible": true + }, + { + "id": "medications", + "order": 13, + "visible": true, + "tileVisible": true + }, + { + "id": "sleep", + "order": 14, + "visible": false, + "tileVisible": true + }, + { + "id": "steps", + "order": 15, + "visible": false, + "tileVisible": true + }, + { + "id": "glucose", + "order": 16, + "visible": false, + "tileVisible": true + }, + { + "id": "achievements", + "order": 17, + "visible": true, + "tileVisible": false + }, + { + "id": "vo2Max", + "order": 18, + "visible": false, + "tileVisible": true + }, + { + "id": "recentWorkouts", + "order": 19, + "visible": true, + "tileVisible": true + }, + { + "id": "cardioRecovery", + "order": 20, + "visible": false, + "tileVisible": false + }, + { + "id": "sixMinuteWalk", + "order": 21, + "visible": false, + "tileVisible": false + }, + { + "id": "stairAscentSpeed", + "order": 22, + "visible": false, + "tileVisible": false + }, + { + "id": "stairDescentSpeed", + "order": 23, + "visible": false, + "tileVisible": false + }, + { + "id": "breathingDisturbances", + "order": 24, + "visible": false, + "tileVisible": false + }, + { + "id": "falls", + "order": 25, + "visible": false, + "tileVisible": false + }, + { + "id": "walkingSteadiness", + "order": 26, + "visible": false, + "tileVisible": false + }, + { + "id": "vorsorge", + "order": 27, + "visible": true, + "tileVisible": false + }, + { + "id": "waterIntake", + "order": 28, + "visible": false, + "tileVisible": true + } + ], + "heroRingOrder": [ + "HEALTH_SCORE", + "MED_COMPLIANCE" + ], + "chartOverlayPrefs": { + "bp": { + "showTrendArrow": true, + "showTargetRange": true, + "comparisonBaseline": "none", + "showTrendIndicator": true + }, + "weight": { + "rangePoints": 30, + "showTrendArrow": true, + "showTargetRange": false, + "comparisonBaseline": "none", + "showTrendIndicator": false + } + }, + "comparisonBaseline": "lastMonth", + "selectedScoreRings": [ + "MED_COMPLIANCE" + ] + } +} diff --git a/tests/integration/routes/parity/dashboard-widgets.parity.test.ts b/tests/integration/routes/parity/dashboard-widgets.parity.test.ts new file mode 100644 index 000000000..0faca0745 --- /dev/null +++ b/tests/integration/routes/parity/dashboard-widgets.parity.test.ts @@ -0,0 +1,313 @@ +/** + * Parity for `GET / PUT / DELETE /api/dashboard/widgets` while the layout + * logic moves out of the route into `src/lib/dashboard/widgets/`. + * + * One owner walks through the cases the route tells apart, in order, each + * request seeing what the earlier ones stored: the first read (the default + * layout, filled into the cache), the same read from the cache, a full save + * that carries ids outside the catalogue, a partial save that leans on the + * stored layout (including a per-chart range the client left out), the + * refusals (schema, an empty body, junk and stale base tokens), a save on + * the current token, reads with the recovery module off before and after an + * HRV series exists, a delegate reading the owner's layout and being refused + * the write and the reset, the owner's reset, and an anonymous call. After + * each request the snapshot holds the response, the wide event and the + * stored layout blob. + * + * The clock is pinned (`Date` only) and moved one second per step, so the + * concurrency token advances between writes the way it does in production. + */ +import { afterAll, beforeAll, describe, expect, it, vi } from "vitest"; + +import { DELETE, GET, PUT } from "@/app/api/dashboard/widgets/route"; +import { DEFAULT_DASHBOARD_LAYOUT } from "@/lib/dashboard-layout"; + +import { + anonymous, + callRoute, + type HttpMethod, + type RouteAuth, +} from "../../../kit/call-route"; +import { + makeGrant, + makeMeasurement, + makeSession, + makeUser, + type SessionFixture, +} from "../../../kit/factories"; +import { + eventFacts, + expectParity, + stable, + wideEventRecorder, +} from "../../../kit/parity"; +import { headerJar } from "../../mock-next-headers"; +import { + getPrismaClient, + switchSessionTo, + truncateAllTables, +} from "../../setup"; + +vi.mock("@/lib/logging/transports", async (importOriginal) => { + const actual = + await importOriginal(); + const { wideEventRecorder: recorder } = await import("../../../kit/parity"); + return { + ...actual, + emitIfSampled: (event: (typeof recorder.events)[number]) => { + recorder.events.push(event); + }, + }; +}); + +const prisma = getPrismaClient(); +const NOW = new Date("2026-10-15T12:00:00.000Z"); +const ROUTE = "/api/dashboard/widgets"; +const HANDLERS = { GET, PUT, DELETE } as const; + +let ownerId: string; +let owner: SessionFixture; +let delegate: SessionFixture; +let tick = 0; + +/** The cache key is a hash of the account id, which differs on every run. */ +const VOLATILE = ["cache.dashboardWidgets.key_hash"]; + +/** A widget as the wire carries it: any id, so unknown ones can be sent. */ +interface WireWidget { + id: string; + visible: boolean; + tileVisible: boolean; + order: number; +} + +function fullLayout(extra: Record = {}) { + return { + version: 1, + widgets: DEFAULT_DASHBOARD_LAYOUT.widgets.map((w): WireWidget => ({ + id: w.id, + visible: w.visible, + tileVisible: w.tileVisible ?? w.visible, + order: w.order, + })), + comparisonBaseline: "none", + chartOverlayPrefs: {}, + selectedScoreRings: ["MED_COMPLIANCE"], + heroRingOrder: ["HEALTH_SCORE", "MED_COMPLIANCE"], + enabledHeroItemKinds: [], + hero: "score", + todayCardVisible: true, + ...extra, + }; +} + +async function stored() { + const row = await prisma.user.findUniqueOrThrow({ + where: { id: ownerId }, + select: { dashboardWidgetsJson: true }, + }); + return row.dashboardWidgetsJson; +} + +async function step( + name: string, + method: HttpMethod, + options: { + auth?: RouteAuth; + body?: unknown; + headers?: Record; + contract?: { skip: string }; + } = {}, +): Promise<{ data: unknown }> { + tick += 1; + vi.setSystemTime(new Date(NOW.getTime() + tick * 1000)); + wideEventRecorder.take(); + const handler = HANDLERS[method as keyof typeof HANDLERS]; + const res = await callRoute(handler, { + method, + route: ROUTE, + body: options.body, + headers: options.headers, + contract: options.contract, + auth: options.auth ?? owner, + }); + const events = wideEventRecorder.take(); + expect(events.length).toBeGreaterThan(0); + await expectParity( + `dashboard-widgets.${name}`, + stable( + { + status: res.status, + body: res.body, + events: events.map(eventFacts), + stored: await stored(), + }, + { since: NOW, volatileKeys: VOLATILE }, + ), + ); + return { data: res.data }; +} + +function tokenOf(data: unknown): string { + const token = (data as { updatedAt?: unknown } | null)?.updatedAt; + if (typeof token !== "string") throw new Error("no updatedAt in response"); + return token; +} + +beforeAll(async () => { + vi.useFakeTimers({ toFake: ["Date"], now: NOW }); + await truncateAllTables(prisma); + const ownerRow = await makeUser({ timezone: "UTC" }); + ownerId = ownerRow.id; + owner = await makeSession(ownerRow); + const delegateRow = await makeUser({ timezone: "UTC" }); + delegate = await makeSession(delegateRow); + await makeGrant(ownerRow, delegateRow, { access: "WRITE" }); +}); + +afterAll(() => { + vi.useRealTimers(); +}); + +describe("/api/dashboard/widgets parity", () => { + let lastToken = ""; + + it("01 the first read, filled into the cache", async () => { + const { data } = await step("01-get-default", "GET"); + lastToken = tokenOf(data); + }); + + it("02 the same read from the cache", async () => { + await step("02-get-cached", "GET"); + }); + + it("03 a full save carrying ids outside the catalogue", async () => { + const body = fullLayout({ comparisonBaseline: "lastMonth" }); + body.widgets.push( + { id: "retired-tile", visible: true, tileVisible: true, order: 90 }, + { id: "typo-tile", visible: false, tileVisible: false, order: 91 }, + ); + body.chartOverlayPrefs = { + weight: { + showTrendIndicator: true, + showTrendArrow: false, + showTargetRange: true, + rangePoints: 30, + }, + }; + const { data } = await step("03-put-full-unknown-ids", "PUT", { body }); + lastToken = tokenOf(data); + }); + + it("04 a partial save that keeps the stored fields and range", async () => { + const { data } = await step("04-put-partial-preserve", "PUT", { + body: { + version: 1, + chartOverlayPrefs: { + weight: { + showTrendIndicator: false, + showTrendArrow: true, + showTargetRange: false, + }, + bp: { + showTrendIndicator: true, + showTrendArrow: true, + showTargetRange: true, + }, + }, + hero: "reminders", + }, + }); + lastToken = tokenOf(data); + }); + + it("05 a body the schema refuses", async () => { + await step("05-put-invalid", "PUT", { + body: { + version: 2, + widgets: [{ id: "weight", visible: "yes", order: 1 }], + comparisonBaseline: "lastDecade", + password: "hunter2", + }, + }); + }); + + it("06 a request without a body", async () => { + await step("06-put-empty-body", "PUT", { + body: undefined, + headers: { "content-type": "application/json" }, + // The registry declares no 400 for this operation; the parity walk + // pins the answer the route gives, not the contract. + contract: { skip: "400 for an unreadable body is not registered" }, + }); + }); + + it("07 a junk base token", async () => { + await step("07-put-invalid-base", "PUT", { + body: { version: 1, baseUpdatedAt: 42, todayCardVisible: false }, + }); + }); + + it("08 a stale base token", async () => { + await step("08-put-stale-base", "PUT", { + body: { + version: 1, + baseUpdatedAt: "2026-01-01T00:00:00.000Z", + todayCardVisible: false, + }, + }); + }); + + it("09 a save on the current token", async () => { + const { data } = await step("09-put-current-base", "PUT", { + body: { version: 1, baseUpdatedAt: lastToken, todayCardVisible: false }, + }); + lastToken = tokenOf(data); + }); + + it("10 reads with recovery off, without HRV and with one series", async () => { + await prisma.user.update({ + where: { id: ownerId }, + data: { modulePreferencesJson: { recovery: false } }, + }); + await step("10a-get-recovery-off-no-hrv", "GET"); + await makeMeasurement( + { id: ownerId }, + { + type: "HRV_RMSSD", + value: 41, + unit: "ms", + measuredAt: new Date("2026-10-14T06:00:00.000Z"), + }, + ); + await step("10b-get-recovery-off-rmssd", "GET"); + }); + + it("11 a delegate reads the owner's layout and may not change it", async () => { + await switchSessionTo(delegate.sessionId, ownerId); + try { + await step("11a-delegate-get", "GET", { auth: delegate }); + await step("11b-delegate-put", "PUT", { + auth: delegate, + body: { version: 1, comparisonBaseline: "lastYear" }, + }); + await step("11c-delegate-delete", "DELETE", { auth: delegate }); + } finally { + await switchSessionTo(delegate.sessionId, null); + headerJar.delete("x-healthlog-record-epoch"); + headerJar.delete("x-healthlog-record-scope"); + } + }); + + it("12 the owner resets the layout", async () => { + await step("12-delete-reset", "DELETE"); + }); + + it("13 the read after the reset", async () => { + await step("13-get-after-reset", "GET"); + }); + + it("14 an anonymous call", async () => { + await step("14-anonymous-get", "GET", { auth: anonymous }); + }); +});