Repository navigation
test(mabr): cover public discovery export - #24
Conversation
There was a problem hiding this comment.
Ally — Consolidated PR Review
Lenses: pr-review-toolkit (code, tests, comments, errors, types) + gstack/review + native-codex (applied directly; no nested CLI).
Reviewed head: ee3f1ea
Looks good. Test-only change: imports discoverSlsEndpoint via src/index.ts and exercises the single-SLT (/slt/<n>) path with a globalServiceID match. Verified against route.ts:233-247 — the /\/slt\/\d+$/ branch fetches base.href once, so the asserted URL is exact, and parseSltEndpoints (route.ts:211-228) yields {group, port, source} in that shape. fetch is restored in finally.
Critical Issues (0)
Important Issues (0)
Suggestions (2)
- [pr-review-toolkit:tests]
packages/mabr-route-proxy/src/index.test.ts:7— the stub ignoresinit.discoverSlsEndpointdeliberately sends{ credentials: 'omit', mode: 'cors' }(route.ts:239-242, a privacy property of the public API). Acceptinit?: RequestInitandassert.equal(init?.credentials, 'omit')so a regression there is caught by the same test. - [native-codex]
packages/mabr-route-proxy/src/index.test.ts:3— the test covers the entry source (./index.ts), not the builtexports["."]→./dist/index.jsmapping. Fine for catching a dropped re-export; just note the PR body's "through the package entry point" means the source entry, and the dist path is only covered bybuild/test:e2e.
Strengths
- Closes a real gap: the public discovery export was previously untested from the entry module.
- Uses
globalServiceIDstring matching, covering the generic delivery-service path rather than only numericserviceId.
Recommended Action
- No blocking changes requested.
- Merge once the remaining required CI checks finish green.
ee3f1ea to
d8b57e8
Compare
There was a problem hiding this comment.
Ally — Consolidated PR Review
Lenses: pr-review-toolkit (code, tests, comments, errors, types) + gstack/review + native-codex (applied directly; no nested CLI).
Reviewed head: d8b57e8
Looks good. Test-only change re-reviewed after the branch was rewritten (prior head is not an ancestor; same single file). The stub now also asserts init.credentials === 'omit' and init.mode === 'cors', matching route.ts:242 at this head — this addresses the earlier suggestion and locks in the privacy property of the public discovery API. The /slt/<n> branch (route.ts:246) fetches the URL once, so the exact-URL assertion holds; discoverSlsEndpoint is re-exported at index.ts:11; fetch is restored in finally.
Critical Issues (0)
Important Issues (0)
Suggestions (1)
- [native-codex]
packages/mabr-route-proxy/src/index.test.ts:3— the test imports the source entry (./index.ts), not the builtexports["."]→distmapping; the dist path remains covered only bybuild/test:e2e. Fine for catching a dropped re-export.
Strengths
- Closes a real coverage gap on a public export, including the credential-omission contract.
- Exercises the generic
globalServiceIDstring-match path.
Recommended Action
- No blocking changes requested.
- Merge once the remaining required CI checks finish green.
Problem
The browser discovery helper is public API, but the package-entry test only covered the fetch proxy. A package consumer could lose the export without the package tests catching it.
Change
Import
discoverSlsEndpointthrough@blockcast/mabr-route-proxy's entry point and verify generic delivery-service SLT discovery returns the advertised SLS(S,G)and source.Validation
npm run typechecknpm run buildnpm test(33 passed)npm run test:e2e