Skip to content

Bump server/shared: adopt shared e2e test helpers in Student CRUD spec - #134

Merged
buzz-code merged 2 commits into
mainfrom
claude/docs-test-coverage-projects-6ex6b1
Aug 12, 2026
Merged

buzz-code merged 2 commits into
mainfrom
claude/docs-test-coverage-projects-6ex6b1

Conversation

@buzz-code

Copy link
Copy Markdown
Owner

Summary

Bumps server/shared to pick up nra-server's new e2e test helpers (registerAndAuthenticate(), asList(), TestAppHelper now wiring cookie-parser itself — see nra-server PR #33, merged) and swaps server/test/student-crud.e2e-spec.ts to use them, per the CONSUMER_CHANGES.md row for commit 28a61f5.

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 pass
  • cd server && yarn test — 97 suites / 919 tests pass

Generated by Claude Code

…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
Copilot AI lite review requested due to automatic review settings August 12, 2026 18:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines 22 to 24
afterAll(async () => {
if (dataSource?.isInitialized) {
await dataSource.destroy();
}
await app?.close();
await moduleFixture?.close();
await testApp.cleanup();
});

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@buzz-code
buzz-code merged commit d7982c4 into main Aug 12, 2026
3 checks 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.

3 participants