test(creators): assert no leaked internals and 404 shape parity for creator detail - #676
Merged
Chucks1093 merged 1 commit intoJul 30, 2026
Conversation
…reator detail Extends the creator detail 404 integration test to cover the remaining acceptance criteria from accesslayerorg#665: the response must match the standard { success, error: { code, message } } envelope used by other 404s (e.g. GET /:id/holders), and must not leak Prisma/DB error details, table or model names, or stack traces.
|
@Rafiat30 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Closes #665
Summary
The creator detail endpoint (
GET /api/v1/creators/:id) already returns a 404 for a non-existent creator, and a basic integration test for that already existed. This PR extends that test to explicitly cover the remaining acceptance criteria from #665 that weren't yet asserted:GET /:id/holders), with no extra/unexpected fields.ECONNREFUSED).Files changed
src/modules/creators/creator-detail-not-found.integration.test.ts— added two new test cases to the existingdescribe('GET /api/v1/creators/:id — not found')block.No production code was changed — the 404 behavior itself (
httpGetCreatorinsrc/modules/creators/creators.controllers.ts, usingsendNotFound) already satisfied the requirements; this PR closes the test-coverage gap.Implementation details
Two new
it()blocks were added to the existing integration test:matches the standard 404 response shape used by other creator routes— assertsres.bodyis exactly{ success: false, error: { code: 'NOT_FOUND', message: 'Creator not found' } }viatoEqual, matching the shape already verified forGET /:id/holdersinsrc/__tests__/integration/creator-holders-404.test.ts.does not leak database errors, table/model names, or stack traces— serializes the response body to a lowercased JSON string and asserts it does not contain any of a list of forbidden substrings (stack,trace,prisma,creatorprofile,creator_profile,select,sql,.ts:,.js:,node_modules,at object,errno,econnrefused). It also assertserrorobject keys are exactly['code', 'message'], ruling out leaked fields like Prisma'smeta/clientVersion.Both tests reuse the existing mocking setup in the file (
creatorProfileExistsmocked to resolvefalse,prisma.utilsmocked) so no real database is needed.Tests added
src/modules/creators/creator-detail-not-found.integration.test.tsreturns 404 with the standard error shape for a non-existent creator(pre-existing, unchanged)matches the standard 404 response shape used by other creator routes(new)does not leak database errors, table/model names, or stack traces(new)How to test
pnpm install pnpm generate # generates the Prisma client used by src/app.ts npx jest src/modules/creators/creator-detail-not-found.integration.test.tsExpected: 3 passing tests, 0 failing.
I also ran
pnpm lint,pnpm build, and the fulljestsuite locally — lint and build are clean, and this change does not introduce any new test failures (pre-existing failures elsewhere in the suite, e.g.creator-list-item.mapper.test.tsandcreator-list-page.guard.test.ts, are unrelated to this change and reproduce identically onmainwithout it).