Repository navigation
Bump server/shared: adopt shared e2e test helpers in Student CRUD spec - #134
Conversation
…nt CRUD e2e Per CONSUMER_CHANGES.md row 28a61f5 in nra-server: swap the hand-rolled Test.createTestingModule/cookie-parser/cookie-regex/teardown boilerplate for the new shared helpers (createTestApp + registerAndAuthenticate + asList). 73 lines -> 56, same behavior. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017YepEQ4PfrEhS2L8imLLRe
There was a problem hiding this comment.
Pull request overview
Refactor server e2e student CRUD spec to use new shared nra-server e2e helpers from server/shared, reducing duplicated Nest app setup/auth/list-shape boilerplate.
Changes:
- Switch e2e app bootstrap/teardown to
createTestApp()+TestAppHelper. - Replace inline auth-cookie extraction with
registerAndAuthenticate(). - Replace inline list normalization helper with shared
asList().
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| afterAll(async () => { | ||
| if (dataSource?.isInitialized) { | ||
| await dataSource.destroy(); | ||
| } | ||
| await app?.close(); | ||
| await moduleFixture?.close(); | ||
| await testApp.cleanup(); | ||
| }); |
There was a problem hiding this comment.
Fair catch on the wording — "same behavior" referred to the CRUD lifecycle assertions (create/list/update/delete), not teardown error handling, which does change here. TestAppHelper.cleanup()'s swallow-and-warn is pre-existing behavior in nra-server (predates this PR — the baseline app.e2e-spec.ts in every app already goes through it via createSharedAppE2eTests), not something introduced by this change.
Whether teardown failures should fail the suite is a real question, but it's a TestAppHelper design change in the shared nra-server repo, affecting every consumer of cleanup() across all 5 apps — bigger scope than this PR. Leaving it as a follow-up rather than bundling it in here.
Generated by Claude Code
If beforeAll throws before testApp is assigned, Jest still runs afterAll — testApp?.cleanup() avoids a TypeError there masking the real beforeAll failure. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017YepEQ4PfrEhS2L8imLLRe
Summary
Bumps
server/sharedto pick upnra-server's new e2e test helpers (registerAndAuthenticate(),asList(),TestAppHelpernow wiringcookie-parseritself — seenra-serverPR #33, merged) and swapsserver/test/student-crud.e2e-spec.tsto use them, per theCONSUMER_CHANGES.mdrow for commit28a61f5.Drops the hand-rolled
Test.createTestingModule/cookie-parser/cookie-regex/teardown boilerplate that was duplicated across all 5 apps' CRUD e2e specs — 73 lines → 56, same behavior.Testing
cd server && yarn test:e2e— 2 suites / 4 tests passcd server && yarn test— 97 suites / 919 tests passGenerated by Claude Code