test: guard mock API module wiring against unmatched-block regressions (#382) - #400
Merged
Lakes41 merged 1 commit intoAug 21, 2026
Conversation
…ld#382) lib/api/mock.ts previously grew into a single 2000+ line file that reached EOF with an unmatched block delimiter, breaking parsing of the module and, transitively, lib/api/index.ts and components/nav.tsx. That file has since been split into focused lib/api/mock/*.ts domain modules aggregated by MockAccessApi (see the module-boundary comment at the top of lib/api/mock.ts), which resolves the parse failure. This adds a test that exercises the public API boundary and one method from each domain module, so a future regression in the module wiring or a reintroduced parse error is caught by the test suite instead of surfacing as a root-route HTTP 500.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
lib/api/mock.tspreviously reached EOF with an unmatched block delimiter (the error surfaced around the oldresourceAccessreturn block, lines 2114-2117), breaking parsing of the module and, transitively,lib/api/index.tsandcomponents/nav.tsx— the root route returned HTTP 500.lib/api/mock/*.ts(core, session, members, analytics, webhooks, approvals, social, moderation, governance, controls, scenarios, fixtures, state), aggregated by theMockAccessApiclass inlib/api/mock.ts, which resolves the unmatched-delimiter parse failure as a side effect.test/mock-api-module-wiring.test.ts) that exercises the public API boundary and one method from each domain module, so a future wiring or parse regression inlib/api/mock.tsis caught by the test suite instead of surfacing as a root-route 500.Verification
npx tsc --noEmitonlib/api/mock.tsandlib/api/index.ts: no parse/syntax errors (only pre-existing, unrelated type errors from missing@types/node).MockAccessApi module wiring (#382)— 2/2 passing (compiled and run in isolation againstlib/api/mock.ts+lib/api/index.ts, since the fullnpm testrun currently fails at thetsc -p test/tsconfig.jsonstep on pre-existing, unrelated errors in other files — none inlib/api/mock*or this new test).Test plan
lib/api/mock.tsparses successfullylib/api/index.tsimports it without a syntax errorCloses #382