No production file changes. internal/server/new_handler_db_test.go builds the
router on the test database with a Stripe mock and adds three tests.
TestNewHandlerPages signs in a member and an operator of the World and GETs
every route of the route table that is outside the sign-in flow and is not
the panicking fake route, as the operator under /operator and
/partials/operator and as the member elsewhere. It writes status, Location
whole and the page's heading (or a fragment's first opening tag) to
testdata/route_pages.golden, plus the certificate ask for an unknown domain.
The golden was written once with -update and read against the code. A Stripe
mock refuses every call, so no page reaches Stripe. The two member lists
that print what the database holds (plans and add-ons) record status and
location only, because their first element changes with the ladders and
products other tests leave in the shared database.
TestCheckoutThroughTheRouter posts a price through the router as the buyer:
303 to the session's URL, the key mode asked once, and the session request
returning to the configured base URL.
TestMemberPagesThroughTheRouter has nine subtests on one router and a
recording mock: the workspace region from two workspaces, each region equal
to what its partial answers, only pending claims listed, the checkout banner
for success, cancel and other, a successful return reconciling and a
canceled one not, the reconcile conferring a rung before the page reads the
organization's holdings and before it includes the regions that show them
(one organization is read with no card, another with the entitlements
partial as the only card), no reconcile without a Stripe key, the billing
facts repeated on a successful return, and the empty state following the
organization's holdings.
Shown to change no output: no production file is touched, and the names and
results of internal/server and internal/testkit equal the parent's apart
from the three new tests and their nine subtests. The three pass three runs
in a row on a reset database. Of the 28 breaks of the plan (27, and one that
moves the reconcile after the workspaces include and the cards loop), each
applied to the production code after a green control run, 26 are caught; two
were missed by TestNewHandlerPages and are dropped: the operator domains
page reading the registry, and the operator partials reading the
integrations' configuration (the page answers the same status and heading
when the read is absent).
The reconcile's write before the holdings read is probed by "a successful
return shows what the reconcile conferred" on the organization read with no
card, and its write before the includes by the same subtest on the card that
shows the ladder; the break that moves the reconcile after both is caught.
Left unprobed:
- The reconcile's order against the workspaces include alone: the region
shows the organization's workspaces, not what it holds, so a reconcile
placed between that include and the cards loop changes nothing a test
reads.
- The dashboard's root-only check: the route-aware dispatch answers every
unknown path before the dashboard runs, so only an include reaches it, and
without the check the dashboard would include itself without end.
- The dashboard's billing-facts gate on a successful return: the template
prints the facts only inside the success banner, so the gate changes
nothing a member sees.
- The member shell's fields (the rail's active entry, the operator switch,
the account menu): every member page renders them and the screens capture
them; no subtest reads them.
- Wiring the pages golden does not reach: the Stripe mode, the key
fingerprint, the dashboard URL, the configured flag, the Temporal client,
the integration configurations, both registries' policy, the external-claim
gate, the connect target, the ask fallback URL, each logger and the
member domains handler's domain queries. A page fact per field would be
needed, and the headings do not hold one.
- Each page's own answer beyond its status and heading.