Skip to content

test: guard mock API module wiring against unmatched-block regressions (#382) - #400

Merged
Lakes41 merged 1 commit into
Adamantine-guild:mainfrom
JuliobaCR:fix/382-mock-api-block-structure
Aug 21, 2026
Merged

test: guard mock API module wiring against unmatched-block regressions (#382)#400
Lakes41 merged 1 commit into
Adamantine-guild:mainfrom
JuliobaCR:fix/382-mock-api-block-structure

Conversation

@JuliobaCR

Copy link
Copy Markdown
Contributor

Summary

  • lib/api/mock.ts previously reached EOF with an unmatched block delimiter (the error surfaced around the old resourceAccess return block, lines 2114-2117), breaking parsing of the module and, transitively, lib/api/index.ts and components/nav.tsx — the root route returned HTTP 500.
  • The file was subsequently split into focused domain modules under lib/api/mock/*.ts (core, session, members, analytics, webhooks, approvals, social, moderation, governance, controls, scenarios, fixtures, state), aggregated by the MockAccessApi class in lib/api/mock.ts, which resolves the unmatched-delimiter parse failure as a side effect.
  • This PR adds a regression test (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 in lib/api/mock.ts is caught by the test suite instead of surfacing as a root-route 500.

Verification

  • npx tsc --noEmit on lib/api/mock.ts and lib/api/index.ts: no parse/syntax errors (only pre-existing, unrelated type errors from missing @types/node).
  • New test passes: MockAccessApi module wiring (#382) — 2/2 passing (compiled and run in isolation against lib/api/mock.ts + lib/api/index.ts, since the full npm test run currently fails at the tsc -p test/tsconfig.json step on pre-existing, unrelated errors in other files — none in lib/api/mock* or this new test).

Test plan

  • lib/api/mock.ts parses successfully
  • lib/api/index.ts imports it without a syntax error
  • New regression test added and passing
  • Existing mock API return values/control flow unchanged (no production code modified — this PR only adds a test)

Closes #382

…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.
@Lakes41
Lakes41 merged commit 5a3de61 into Adamantine-guild:main Aug 21, 2026
1 check passed
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.

Repair unmatched block structure in lib/api/mock.ts

2 participants