Skip to content

test(ios-readplace): extract per-item routing and web 4xx policy into tested seams#924

Closed
FagnerMartinsBrack wants to merge 2 commits into
ios/test-qualityfrom
ios/testable-view-seams
Closed

test(ios-readplace): extract per-item routing and web 4xx policy into tested seams#924
FagnerMartinsBrack wants to merge 2 commits into
ios/test-qualityfrom
ios/testable-view-seams

Conversation

@FagnerMartinsBrack

Copy link
Copy Markdown
Member

Stacked on #923 (base = ios/test-quality). Review/merge after it.

Purpose

Two behavioural decisions lived inside SwiftUI/WebKit glue with no unit-test seam, unlike their already-extracted twins (ToolbarRoute, HTMLCaptor.navigationResponseDecision). This extracts them into pure, gated values, leaving the views with only their effect/plumbing.

What changed & the value

  • ItemRoute lifts the per-item routing out of ReadingListView.activate: a link opens, a destructive action confirms, any other action invokes. The contract-relevant behaviours — a link-only item control opens rather than being silently dropped, and a destructive control never invokes without a confirmation — are now unit-tested without standing up a view. Mirrors ToolbarRoute exactly.
  • WebResponsePolicy lifts the "a 4xx/5xx status is a failure" rule out of the WebPageView navigation delegate. WKWebView delivers error statuses through didFinish (not didFail), so the web view would otherwise paint the server's error body; the policy is tested at the 399/400 boundary.

Both new files are gated at 100% (the coverage gate requires a new logic file to be fully covered); ReadingListView and WebPageView keep only their effect/plumbing and stay in the OS-boundary exclusions.

Testing

Full suite green with the gate (249 tests, +7; iOS coverage gate passed: 23 files at or above floor, 9 excluded), plus the STAGING smoke pass.

… tested seams

Two behavioural decisions were embedded in SwiftUI/WebKit glue with no unit-test
seam, unlike their already-extracted twins (`ToolbarRoute`,
`HTMLCaptor.navigationResponseDecision`):

- `ItemRoute` lifts the per-item routing out of `ReadingListView.activate` — a
  link opens, a destructive action confirms, any other action invokes — so the
  contract-relevant behaviours (a link-only item control opens rather than being
  dropped; a destructive control never invokes without confirmation) are
  unit-tested without a view.
- `WebResponsePolicy` lifts the "a 4xx/5xx status is a failure" rule out of the
  `WebPageView` navigation delegate (WKWebView delivers error statuses through
  `didFinish`, so the web view would otherwise paint the error body), tested at
  the 399/400 boundary.

Both new files are gated at 100%; the views keep only their effect/plumbing.
@FagnerMartinsBrack

Copy link
Copy Markdown
Member Author

Superseded by #927, which consolidates all 9 stacked PRs into one PR targeting main (so CI runs and it's independently deployable). See #927 for the full description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant