Plan: 100% Integration & E2E Test Coverage
- Status
- Context
- Scope
- Design
- Steps
- Step 1: canopy-tanf integration tests
- Step 2: canopy-medicaid integration tests
- Step 3: canopy-snap missing endpoints
- Step 4: canopy-appeals lifecycle endpoints
- Step 5: canopy-enrollment lifecycle endpoints
- Step 6: canopy-renewals lifecycle endpoints
- Step 7: canopy-notices generation and happy paths
- Step 8: canopy-reporting generation endpoints
- Step 9: canopy-security remaining endpoints
- Step 10: canopy-rules CRUD endpoints
- Step 11: canopy-applications missing endpoints
- Step 12: canopy-persons remaining endpoints
- Step 13: canopy-verification SAVE adapter endpoints
- Step 14: Strengthen weak assertions in existing integration tests
- Step 15: E2E — fix weak patterns
- Step 16: E2E — action effect verification
- Step 17: E2E — multi-step workflow tests
- Step 18: E2E — page content and tab content verification
- Files Touched
- Verification
- Documentation Updates
Status
| Step | Description | Status |
|---|---|---|
1 |
canopy-tanf integration tests (9 endpoints, new file) |
Done (2026-04-09) |
2 |
canopy-medicaid integration tests (7 endpoints, new file) |
Done (2026-04-09) |
3 |
canopy-snap missing endpoints (POST /determine, ABAWD, params, resolve discrepancy) |
Done (2026-04-09) |
4 |
canopy-appeals lifecycle endpoints (schedule, decision, withdraw, full IPV lifecycle) |
Done (2026-04-09) |
5 |
canopy-enrollment lifecycle endpoints (issue, list issuances, terminate) |
Done (2026-04-09) |
6 |
canopy-renewals lifecycle endpoints (get cert, interim contact, change report) |
Done (2026-04-09) |
7 |
canopy-notices generation and happy paths (POST /notices, resend, get by id, get pdf) |
Done (2026-04-09) |
8 |
canopy-reporting generation endpoints (POST fns-388, QC universe, CSV export) |
Done (2026-04-09) |
9 |
canopy-security remaining endpoints (get event/alert by id, update alert, archive) |
Done (2026-04-09) |
10 |
canopy-rules CRUD endpoints (list, get, update, delete rule-sets) |
Done (2026-04-09) |
11 |
canopy-applications missing endpoints (list, update, interview waive/complete) |
Done (2026-04-09) |
12 |
canopy-persons remaining endpoints (remove member, add asset/expense/address) |
Done (2026-04-09) |
13 |
canopy-verification SAVE adapter endpoints |
Done (2026-04-09) |
14 |
Strengthen weak assertions in existing integration tests |
Done (2026-04-09) |
15 |
E2E: fix weak patterns (.catch, waitForTimeout, permissive status lists) |
Done (2026-04-09) |
16 |
E2E: action effect verification with seed data |
Done (2026-04-09) |
17 |
E2E: multi-step workflow tests |
Done (2026-04-09) |
18 |
E2E: page content and tab content verification |
Done (2026-04-09) |
Branch: test/100-pct-coverage
Context
Phase 1 test coverage remediation brought the suite from ~107 to 403 tests.
Subsequent work brought us to 521 unit tests, 115 integration tests, and 72 E2E tests (703 total).
A 6-agent audit identified that only 59 of 137 endpoints (43%) have integration tests, and E2E tests rely on weak assertion patterns (.catch(() ⇒ false), permissive status lists, no action effect verification).
Two entire services (canopy-tanf, canopy-medicaid) have zero integration tests despite being fully implemented with 9 and 7 endpoints respectively.
canopy-snap’s core endpoint (POST /determine) — the main SNAP eligibility determination — has no integration test.
The appeals service has 18 endpoints but only 6 are tested; the entire appeal/IPV lifecycle (schedule → decision → withdraw) is uncovered.
This plan delivers 100% endpoint coverage with:
-
Every endpoint tested (happy path)
-
404 for nonexistent resources
-
400/409 for invalid/duplicate inputs where applicable
-
RBAC 401/403 for unauthenticated and wrong-role access
-
Strong assertions (
assert_eq!with specific expected values, notis_string()/is_array())
Scope
In scope:
-
Integration tests for all 78 untested endpoints across 14 services
-
Sad-path tests (404, 400, 409) for every service
-
RBAC 403 tests for canopy-tanf and canopy-medicaid
-
Assertion strengthening for all existing integration tests
-
E2E weak pattern fixes (7 sites)
-
E2E action effect verification (5 tests)
-
E2E multi-step workflow tests (2 tests)
-
E2E page/tab content verification
Out of scope:
-
Stub services (canopy-exchange, canopy-caps, canopy-wic, canopy-portal) — no domain routes
-
Load/performance testing
-
canopy-web BFF integration tests — covered by E2E Playwright tests instead
-
New UI features (action form modals) — E2E tests use direct API calls for actions without UI
Design
All integration tests follow the established pattern in canopy-test-lib:
async fn setup() -> Option<TestClient> {
if !canopy_test_lib::infrastructure_available().await {
return None;
}
let c = TestClient::authenticated("http://localhost:{PORT}").await?;
if !c.is_healthy().await {
return None;
}
Some(c)
}
Every test uses strong assertions:
-
assert_eq!(data["field"], "expected_value")— notassert!(data["field"].is_string()) -
assert_eq!(resp.status(), 201)— notassert!(resp.status().is_success()) -
Specific field validation after creation (verify returned data matches input)
-
Lifecycle tests: create → mutate → verify mutation → verify final state
E2E tests replace weak patterns with Playwright best practices:
-
locator.or(otherLocator)instead of.catch(() ⇒ false)with logical OR -
waitForSelector/waitForURLinstead ofwaitForTimeout -
expect([200, 302, 303]).toContain(status)— never accept 401/403/500
Steps
Step 1: canopy-tanf integration tests
Files: services/canopy-tanf/tests/tanf_test.rs (NEW), services/canopy-tanf/Cargo.toml
Add canopy-test-lib to [dev-dependencies].
Create tests/tanf_test.rs with the standard setup (port 8014).
Tests to implement:
| Test Function | Endpoint | Assertion |
|---|---|---|
|
POST /v1/determine |
Status 201, response has |
|
GET /v1/determinations/{id} |
Status 200, fields match what was created |
|
GET /v1/determinations/{fake_uuid} |
Status 404 |
|
GET /v1/determinations/{id}/explanation |
Status 200, response has explanation content |
|
GET /v1/work-requirements/{person_id} |
Status 200, response is array |
|
POST /v1/work-requirements/{person_id}/activities |
Status 201, response has |
|
GET /v1/time-limits/{person_id} |
Status 200, response has time limit fields |
|
GET /v1/fti-audit-log |
Status 200, response is array |
|
GET /v1/fti-audit-log/summary |
Status 200, response has summary fields |
|
GET /v1/fti-audit-log/{fake_uuid} |
Status 404 |
|
GET /v1/determinations (no token) |
Status 401 |
The post_determine test requires a valid household and person in canopy-persons.
Create test data via canopy-persons API first (POST person, POST household, POST income), then call canopy-tanf’s determine endpoint with the household_id.
Step 2: canopy-medicaid integration tests
Files: services/canopy-medicaid/tests/medicaid_test.rs (NEW), services/canopy-medicaid/Cargo.toml
Add canopy-test-lib to [dev-dependencies].
Create tests/medicaid_test.rs with the standard setup (port 8015).
Tests to implement:
| Test Function | Endpoint | Assertion |
|---|---|---|
|
POST /v1/determine |
Status 201, response has |
|
GET /v1/determinations/{id} |
Status 200, fields match creation |
|
GET /v1/determinations/{fake_uuid} |
Status 404 |
|
GET /v1/determinations/{id}/categories |
Status 200, array of COA objects |
|
GET /v1/determinations/{id}/explanation |
Status 200, has explanation content |
|
GET /v1/fti-audit-log |
Status 200, response is array |
|
GET /v1/fti-audit-log/summary |
Status 200, has summary fields |
|
GET /v1/fti-audit-log/{fake_uuid} |
Status 404 |
|
GET /v1/determinations (no token) |
Status 401 |
The post_determine test requires a valid person with demographic data (age, income) to trigger CMD cascade evaluation.
Create a person via canopy-persons with date_of_birth set to make them a child (age 3) for predictable COA assignment (child 1-5 at 149% FPL).
Step 3: canopy-snap missing endpoints
Files: services/canopy-snap/tests/snap_test.rs
Add tests to the existing file:
| Test Function | Endpoint | Assertion |
|---|---|---|
|
POST /v1/determine |
Status 200/201, response has |
|
GET /v1/determinations/{id} (happy path) |
Status 200, |
|
PUT /v1/verification/discrepancies/{id}/resolve |
Status 200, |
|
GET /v1/params |
Status 200, response has |
|
POST /v1/abawd/activity |
Status 201, response has |
|
GET /v1/abawd/tracking?person_id={id} |
Status 200, array response |
|
GET /v1/abawd/tracking/{id}/activities |
Status 200, array response |
The post_determine test is the most critical test in this plan.
It requires: person with income (via canopy-persons), application (via canopy-applications), household composition.
Create all prerequisite data via their respective service APIs, then call POST /v1/determine with the ApplicationContext.
Assert the response includes a valid JWS signature (3 dot-separated parts), correct status (approved/denied based on income vs FPL), and non-zero benefit_amount if approved.
Step 4: canopy-appeals lifecycle endpoints
Files: services/canopy-appeals/tests/appeals_test.rs
Add lifecycle tests that chain operations on a single appeal:
| Test Function | Endpoint | Assertion |
|---|---|---|
|
GET /v1/appeals/{id} (happy path) |
Status 200, |
|
PUT /v1/appeals/{id}/schedule |
Status 200, |
|
PUT /v1/appeals/{id}/decision |
Status 200, |
|
PUT /v1/appeals/{id}/decision |
Status 200, |
|
PUT /v1/appeals/{id}/withdraw |
Status 200, |
|
POST /v1/internal/appeals/clock-check |
Status 200 |
|
GET /v1/ipv/cases/{id} |
Status 200, fields match creation |
|
PUT /v1/ipv/cases/{id}/schedule-adh |
Status 200, |
|
PUT /v1/ipv/cases/{id}/send-notice |
Status 200, |
|
PUT /v1/ipv/cases/{id}/record-decision |
Status 200, |
|
PUT /v1/ipv/cases/{id}/waiver |
Status 200, |
|
PUT /v1/ipv/cases/{id}/impose-disqualification |
Status 200/201, |
|
PUT /v1/ipv/cases/{id}/withdraw |
Status 200, |
|
GET /v1/ipv/disqualifications/active?person_id={id} |
Status 200, array response |
Use a lifecycle pattern: file appeal → get → schedule → decide. For IPV: create referral → get → schedule ADH → send notice → decide → impose disqualification. Each step asserts the state transition is correct.
Step 5: canopy-enrollment lifecycle endpoints
Files: services/canopy-enrollment/tests/enrollment_test.rs
| Test Function | Endpoint | Assertion |
|---|---|---|
|
POST /v1/enrollments/{id}/issue |
Status 201, |
|
GET /v1/enrollments/{id}/issuances |
Status 200, array with issued benefit |
|
POST /v1/enrollments/{id}/terminate |
Status 200, |
|
POST /v1/enrollments/{id}/issue (same month twice) |
Status 409 |
Create enrollment first (existing test), then chain: issue → list issuances → verify → terminate.
Step 6: canopy-renewals lifecycle endpoints
Files: services/canopy-renewals/tests/renewals_test.rs
| Test Function | Endpoint | Assertion |
|---|---|---|
|
GET /v1/renewals/snap/certifications?household_id={id} |
Status 200, array with created cert |
|
GET /v1/renewals/snap/certifications/{id} |
Status 200, fields match creation |
|
POST /v1/renewals/snap/certifications/{id}/interim-contact |
Status 201, |
|
POST /v1/renewals/snap/certifications/{id}/change-report |
Status 201, |
Create certification first (existing test), extract id, then test lifecycle endpoints.
Step 7: canopy-notices generation and happy paths
Files: services/canopy-notices/tests/notices_test.rs
| Test Function | Endpoint | Assertion |
|---|---|---|
|
POST /v1/notices |
Status 201, |
|
GET /v1/notices/{id} (happy path) |
Status 200, all fields from generation present |
|
GET /v1/notices/{id}/pdf (happy path) |
Status 200, content-type contains "pdf" |
|
POST /v1/notices/{id}/resend |
Status 200 |
Generate a notice first, then test get and resend.
The PDF test requires that canopy-typst successfully renders the template, so use a known valid notice type (e.g., approval).
Step 8: canopy-reporting generation endpoints
Files: services/canopy-reporting/tests/reporting_test.rs
| Test Function | Endpoint | Assertion |
|---|---|---|
|
POST /v1/reporting/snap/fns-388 |
Status 201, |
|
GET /v1/reporting/snap/fns-388/{month} |
Status 200, report data present |
|
GET /v1/reporting/snap/fns-388/1999-01 |
Status 404 |
|
POST /v1/reporting/snap/qc-universe |
Status 201 |
|
GET /v1/reporting/snap/qc-universe/{date} |
Status 200, data present |
|
GET /v1/reporting/snap/qc-universe/{date}/csv |
Status 200, content-type contains "csv" |
Reporting endpoints require supervisor-level JWT.
Use TestClient::authenticated_as("supervisor") or equivalent if available, otherwise use default auth which may already have supervisor role.
Step 9: canopy-security remaining endpoints
Files: services/canopy-security/tests/security_test.rs
| Test Function | Endpoint | Assertion |
|---|---|---|
|
GET /v1/security/events/{id} |
Status 200, |
|
GET /v1/security/alerts/{id} |
Status 200, |
|
PATCH /v1/security/alerts/{id} |
Status 200, |
|
GET /v1/security/archive |
Status 200, array response |
|
POST /v1/security/archive |
Status 200, response has |
Chain: list events → get first event by id → verify fields. For alerts: list alerts → get first → patch to resolved → verify resolved.
Step 10: canopy-rules CRUD endpoints
Files: services/canopy-rules/tests/rules_test.rs
| Test Function | Endpoint | Assertion |
|---|---|---|
|
GET /v1/rule-sets |
Status 200, array response |
|
GET /v1/rule-sets/{id} |
Status 200, |
|
PUT /v1/rule-sets/{id} |
Status 200, re-GET shows updated content |
|
DELETE /v1/rule-sets/{id} |
Status 200 or 204, re-GET returns 404 |
|
GET /v1/rule-sets/{fake_uuid} |
Status 404 |
|
DELETE /v1/rule-sets/{fake_uuid} |
Status 404 |
Create a rule set first (existing test), then test get/update/delete.
Step 11: canopy-applications missing endpoints
Files: services/canopy-applications/tests/application_test.rs
| Test Function | Endpoint | Assertion |
|---|---|---|
|
GET /v1/applications |
Status 200, array contains created app |
|
PUT /v1/applications/{id} |
Status 200, re-GET shows updated field |
|
POST /v1/applications/{id}/interview/waive |
Status 200, |
|
POST /v1/applications/{id}/interview/complete |
Status 200, |
|
GET /v1/applications/{fake_uuid} |
Status 404 |
Step 12: canopy-persons remaining endpoints
Files: services/canopy-persons/tests/persons_test.rs
| Test Function | Endpoint | Assertion |
|---|---|---|
|
DELETE /v1/households/{hh_id}/members/{member_id} |
Status 200/204, re-GET household shows reduced member count |
|
POST /v1/persons/{id}/assets |
Status 201, |
|
POST /v1/persons/{id}/expenses |
Status 201, |
|
POST /v1/persons/{id}/addresses |
Status 201, |
The list endpoints for these sub-resources already have tests. These tests add the missing POST/DELETE happy paths.
Step 13: canopy-verification SAVE adapter endpoints
Files: services/canopy-verification/tests/save_test.rs (NEW)
| Test Function | Endpoint | Assertion |
|---|---|---|
|
POST /internal/v1/save/verify |
Status 200, response has |
|
POST /internal/v1/save/additional-verification |
Status 200, response has fields |
|
POST /internal/v1/save/verify (no X-Service-Api-Key) |
Status 401 |
|
POST /internal/v1/save/additional-verification (no key) |
Status 401 |
Follow the IEVS test pattern in ievs_test.rs — use reqwest directly with X-Service-Api-Key header.
Step 14: Strengthen weak assertions in existing integration tests
Files: Multiple test files across services
Specific fixes:
| File:Line | Current | Fix |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Assert the specific expected type |
|
|
|
All |
|
Parse as UUID to validate format |
Step 15: E2E — fix weak patterns
Files: tests/e2e/specs/dashboard.spec.ts, tests/e2e/specs/renewals.spec.ts, tests/e2e/specs/actions.spec.ts, tests/e2e/specs/applications.spec.ts, tests/e2e/lib/helpers.ts
| File:Line | Pattern | Fix |
|---|---|---|
|
|
Use |
|
|
Use |
|
|
|
|
|
|
|
|
|
|
|
Remove catch — let timeout be a real failure |
|
|
|
Step 16: E2E — action effect verification
Files: tests/e2e/specs/actions.spec.ts
Replace smoke-only POST tests with seed-data-backed tests that verify effects.
Use findApproved() from seed data to get a real household_id.
| Test | Verification |
|---|---|
|
POST /appeals/file with seed household → navigate to /appeals → |
|
Click Approve on process page → |
|
Open modal → select reason → submit → verify redirect → verify no error |
|
POST with real cert_id from seed → |
|
POST with real cert_id from seed → verify redirect or success response |
Step 17: E2E — multi-step workflow tests
Files: tests/e2e/specs/workflow.spec.ts (NEW)
| Test | Steps |
|---|---|
|
Search for seed person last name → click result → verify URL is /cases/{id} → click each of 6 tabs → verify each tab panel loads content (not empty, not error) |
|
Navigate to /applications → find expedited app → navigate to process page → verify heading "Process Application" → verify Approve/Deny buttons → verify Rules Engine Result section visible |
Step 18: E2E — page content and tab content verification
Files: tests/e2e/specs/case-detail.spec.ts, tests/e2e/specs/dashboard.spec.ts, tests/e2e/specs/applications.spec.ts
| Test | Assertion |
|---|---|
Dashboard stat card labels |
Verify labels contain "Pending", "Renewals" or equivalent — not just numeric check |
Case detail summary bar content |
After loading, verify |
Household tab has member data |
After clicking household tab, verify |
Income tab has column headers |
After clicking income tab, verify headings like "Earned" or "Unearned" or "Source" |
Determination tab shows result |
After clicking determination tab, verify "ELIGIBLE" or "INELIGIBLE" or "No determination" text |
Applications list table headers |
Navigate to /applications → verify table has headers: "Case", "Status", "Expedited" |
Files Touched
| File | Change |
|---|---|
|
NEW — 11 integration tests |
|
Add canopy-test-lib, uuid, serde_json to dev-dependencies |
|
NEW — 9 integration tests |
|
Add canopy-test-lib, uuid, serde_json to dev-dependencies |
|
Add 7 tests (determine, ABAWD, params, resolve) |
|
Add 14 lifecycle tests (appeal + IPV) |
|
Add 4 lifecycle tests (issue, issuances, terminate) |
|
Add 4 lifecycle tests (get cert, interim contact, change report) |
|
Add 4 tests (generate, get, pdf, resend) |
|
Add 6 tests (generate fns-388, QC universe, CSV) |
|
Add 5 tests (get event/alert, update alert, archive) |
|
Add 6 CRUD tests + fix 2 weak assertions |
|
Add 5 tests (list, update, interview, 404) |
|
Add 4 tests (remove member, add asset/expense/address) |
|
NEW — 4 SAVE adapter tests |
Multiple existing test files |
Fix ~8 weak assertions (Step 14) |
|
Fix .catch pattern, add label assertions |
|
Fix .catch pattern |
|
Fix permissive status lists, add effect verification |
|
Fix silent skip, add list table test |
|
Replace waitForTimeout with waitForSelector |
|
NEW — 2 multi-step workflow tests |
|
Add tab content assertions |
Verification
-
cargo xtask test --unit— all unit tests pass (521+) -
cargo xtask test— all integration tests pass (target: 193+) -
cargo xtask e2e— all E2E tests pass (target: 82+) -
cargo clippy --all-targets — -D warnings— zero warnings -
Every service endpoint appears in at least one integration test
-
No test contains
|| true,.catch(() ⇒ false), or accepts status 500 as valid -
No test uses bare
is_string()/is_array()without also checking content