mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-14 06:40:50 +00:00
test(e2e): cover doctor-report generation end to end
The doctor report had unit coverage for the renderer and route coverage for the envelope, and nothing that pressed the button. Two browser journeys close that. `doctor-report.spec.ts` seeds a few weeks of blood pressure and weight, one allergy and one medication through the page's own `fetch`, picks a window in the export panel and generates. The saved download is asserted as a real artefact — `%PDF` magic, a `Content-Length` that agrees with the bytes, a length no empty document reaches — and then parsed back to text, so the period line, the blood-pressure section and the drug list are read out of the document rather than inferred from a 200. The period is checked as a span, so the assertion survives the account's timezone. Its refusing control is a window with no readings: still a valid, readable report that names the period and carries no blood-pressure section, with the reference data that is not window-scoped as the control against a blank page passing. `doctor-report-delegate.spec.ts` covers the access boundary the route draws at MANAGE. A delegate inside a record it may only read is not offered the export card at all, and the route refuses the request that card would have sent with `sharing.access.denied`. The positive control is the same delegate, the same payload and the same switched-record path against a record it manages, so the one variable between pass and refusal is the access level. Both requests carry the record-context headers the shipped client sends: without them the fence refuses with the same status and the same error code, which would make the refusal pass for the wrong reason. Seeding is idempotent — a re-posted reading collides on its natural key and answers 409 — so a second local run and a repeated run both stay green. The delegate journey takes its own cookie jar because it moves the session's record selector, and both specs run in one project.
This commit is contained in:
1 parent
1d372df3a0
commit
7b06a235e1
5 files changed
+729
No files matched your search
@@ -152,6 +152,17 @@ export default defineConfig({
|
||||
// through stable data-slots, not a mobile layout, so it runs in one
|
||||
// project.
|
||||
"vaccinations.spec.ts",
|
||||
// The doctor-report journey seeds a few weeks of readings into the one
|
||||
// shared account, presses Generate and reads the PDF back off the
|
||||
// download. Two projects doing that in parallel would leave a second
|
||||
// set of rows in the window one of them is asserting an empty report
|
||||
// for — and mobile emulation emits no `download` event for the
|
||||
// anchor click the panel makes, so the artefact would be unreachable
|
||||
// there anyway.
|
||||
"doctor-report.spec.ts",
|
||||
// Its delegate half MOVES the session's record selector, so it runs in
|
||||
// exactly one project for the reason written above the fence specs.
|
||||
"doctor-report-delegate.spec.ts",
|
||||
// Runs only in the service-worker project.
|
||||
"v137-record-session-fence-offline.spec.ts",
|
||||
],
|
||||
|
||||
Reference in new issue
Block a user