mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-12 06:06:10 +00:00
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.
31 lines
968 B
TypeScript
31 lines
968 B
TypeScript
/**
|
|
* Re-export pin for the seeded test-user identity. The cookie jar that
|
|
* authenticates each spec is captured ONCE in `global-setup.ts` and the
|
|
* specs reach for it via `STORAGE_STATE_PATH` directly. We keep this
|
|
* file (instead of a barrel inside global-setup) only so future helpers
|
|
* specific to the spec-side (e.g. multi-user scenarios that need
|
|
* fresh logins) have a natural home.
|
|
*/
|
|
export {
|
|
E2E_USER,
|
|
E2E_OWNER,
|
|
E2E_OWNER_FULL_NAME,
|
|
E2E_GUARDIAN,
|
|
E2E_SCOPE_DELEGATE,
|
|
E2E_SCOPE_RECORDS,
|
|
E2E_LEVEL_RECORDS,
|
|
E2E_DELEGATE_MARKER_KG,
|
|
E2E_OWNER_MARKER_KG,
|
|
STORAGE_STATE_PATH,
|
|
OWNER_STORAGE_STATE_PATH,
|
|
DELEGATE_STORAGE_STATE_PATH,
|
|
SCOPE_DELEGATE_STORAGE_STATE_PATH,
|
|
SCOPE_A11Y_STORAGE_STATE_PATH,
|
|
SCOPE_CAPABILITIES_STORAGE_STATE_PATH,
|
|
FENCE_STORAGE_STATE_PATH,
|
|
FENCE_OFFLINE_STORAGE_STATE_PATH,
|
|
CROSS_TAB_STORAGE_STATE_PATH,
|
|
REPORT_DELEGATE_STORAGE_STATE_PATH,
|
|
GUARDIAN_STORAGE_STATE_PATH,
|
|
} from "./global-setup";
|