test(ui): cover the client-side openapi spec parser and code-sample generators#8428
test(ui): cover the client-side openapi spec parser and code-sample generators#8428kai392 wants to merge 1 commit into
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Warning ⏸️ LoopOver review result - manual review recommendedReview updated: 2026-07-24 12:59:59 UTC
Review summary Nits — 1 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
|
LoopOver closed this because @kai392 has 3 open pull requests, above this repository's configured limit of 2. Close or merge an existing one to open a new one. This is an automated maintenance action. |
Summary
apps/loopover-ui/src/lib/openapi.tshad zero tests despite being the module every/api/*docs page runs at request time — it derives theideach/api/$opURL is keyed on, merges declared vs. path-inferred parameters, extracts response examples, groups tags, rewrites the server origin, and generates the curl/fetch/Python samples. Same class of gap already fixed once for the server-side spec writer in #7770; this is the client-side reader.Adds
apps/loopover-ui/src/lib/openapi.test.ts(14 tests, no production changes).Fixture, not the committed spec.
build()isn't exported and runs at module-import time againstpublic/openapi.json, whose contents drift with every API change. So the spec module is mocked with a small hand-builtRawOpenApiSpecandopenapi.tsis imported dynamically per test (vi.resetModules());getApiOriginis mocked too sonormalizeServers' rewrite is asserted against a fixed origin. Nothing here depends on the real spec's current shape.Covered, per the issue's list:
op.id):GET /v1/repos/{owner}/{repo}→get-v1-repos-owner-repo, with braces stripped, runs collapsed, and no leading/trailing/doubled-{param}is auto-added asrequired: true/in: "path"; a declared one is not duplicated and the author's description winsexample; falls back to the firstexamplesentry — asserted on the real unwrapping (first?.value, i.e.1, not the{ value: 1 }envelope);undefinedwith noapplication/jsoncontent, and no response entries at all for an emptyresponsesraw.tagsDELETEasserted body-less alongsideGET), the trailing-slash strip, and the inline-token vs$LOOPOVER_TOKENbranchCloses #8389
Test plan
npx vitest run --root apps/loopover-ui src/lib/openapi.test.ts— 14/14 greennpm run ui:typecheckclean;prettier --checkclean on the new fileapps/**is outside Codecov'scoverage.include, so this owes nocodecov/patchpercentage; it exists to close a real assertion gap, not to move a number