Skip to content

Move nine more misplaced unit tests to their source mirror paths - #1781

Merged
stefan-burke merged 1 commit into
mainfrom
claude/unit-tests-easy-wins-xlyi1a
Jul 12, 2026
Merged

Move nine more misplaced unit tests to their source mirror paths#1781
stefan-burke merged 1 commit into
mainfrom
claude/unit-tests-easy-wins-xlyi1a

Conversation

@stefan-burke

@stefan-burke stefan-burke commented Jul 12, 2026

Copy link
Copy Markdown
Member

What changed

A third batch of the same low-risk cleanup as #1765 and #1769. Nine unit-test files each check a single piece of code in src/, but sat under test/lib/ (or another folder that mirrors nothing), so the coverage report treated those pieces of source as having no test at all — even though a working test existed.

Each test moves to sit alongside the code it checks:

Test file Now lives at
ledger-picker-dates.test.ts test/features/admin/ledger/picker-dates.test.ts
server-refunds-ui.test.ts test/features/admin/attendee-page-data/refunds-ui.test.ts
routes/api/error-envelope.test.ts test/features/api/cors/error-envelope.test.ts
routes/api/booking-responses.test.ts test/features/api/helpers/booking-responses.test.ts
server-attendee-form/errors.test.ts test/shared/db/attendees/api/errors.test.ts
server-attendee-form/overbooking.test.ts test/shared/db/attendees/atomic-update/overbooking.test.ts
server-questions/question-delete.test.ts test/shared/db/questions/tables/question-delete.test.ts
listings/detail-roster.test.ts test/ui/templates/admin/listings/overview/detail-roster.test.ts
templates/public/view-page.test.ts test/ui/templates/tickets/view-page.test.ts

The one small edit

Eight of these files imported a shared sibling helper by a relative path (./helpers.ts, or ./server-refunds-helpers.ts). That helper is used by many other tests still living in its original folder, so it stays where it is. Each moved test now reaches the helper through the existing #test/ project alias instead of a relative path, so the import resolves correctly from the new location. That's the only change to any file — no test logic was touched. (ledger-picker-dates.test.ts had no relative imports and moved untouched.)

Result

The unit-test report now recognises nine more sources as having a mirrored test (336 → 345, 37.0%), and nine fewer as untested. All nine moved tests were run in their new locations and pass (0 failures); typecheck and lint are clean.

As with the earlier batches, these are the safe subset of the deno task unit-tests-report misplaced-tests list. Remaining candidates that still need more than a rename — the booking/model and stripe groups, which share a widely-imported fixture — were left for a later round.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q8LbdSHz7eSXyqY3GBSAgw


Generated by Claude Code

Summary by CodeRabbit

  • Tests
    • Added coverage for ledger date-range generation, including empty ledgers, future transfers, and ranges extending through today.
    • Standardized shared test helper imports across refund, attendee, booking, question, listing, ticket, and API test suites.
    • Existing test flows and assertions remain unchanged.

A third batch of the same cleanup: nine test files each exercise exactly
one source but lived under test/lib or another folder that mirrors
nothing, so the coverage report counted their sources as untested.
Moving each to its source's mirror location flips nine sources from
untested to mirrored (336 -> 345):

  ledger-picker-dates.test.ts       -> test/features/admin/ledger/picker-dates.test.ts
  server-refunds-ui.test.ts         -> test/features/admin/attendee-page-data/refunds-ui.test.ts
  error-envelope.test.ts            -> test/features/api/cors/error-envelope.test.ts
  booking-responses.test.ts         -> test/features/api/helpers/booking-responses.test.ts
  server-attendee-form/errors...    -> test/shared/db/attendees/api/errors.test.ts
  server-attendee-form/overbooking  -> test/shared/db/attendees/atomic-update/overbooking.test.ts
  server-questions/question-delete  -> test/shared/db/questions/tables/question-delete.test.ts
  listings/detail-roster.test.ts    -> test/ui/templates/admin/listings/overview/detail-roster.test.ts
  templates/public/view-page...     -> test/ui/templates/tickets/view-page.test.ts

Eight of these imported a shared sibling helper by a relative path
(./helpers.ts). Since the helper is used by many other tests in its
original folder, it stays put; each moved test now reaches it through
the existing #test/ alias instead, so the helper import resolves from
the new location. No test logic changed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q8LbdSHz7eSXyqY3GBSAgw
@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 26415dea-7cb4-41f7-942b-7b64c04d0f3c

📥 Commits

Reviewing files that changed from the base of the PR and between 007a9c6 and 9500605.

📒 Files selected for processing (9)
  • test/features/admin/attendee-page-data/refunds-ui.test.ts
  • test/features/admin/ledger/picker-dates.test.ts
  • test/features/api/cors/error-envelope.test.ts
  • test/features/api/helpers/booking-responses.test.ts
  • test/shared/db/attendees/api/errors.test.ts
  • test/shared/db/attendees/atomic-update/overbooking.test.ts
  • test/shared/db/questions/tables/question-delete.test.ts
  • test/ui/templates/admin/listings/overview/detail-roster.test.ts
  • test/ui/templates/tickets/view-page.test.ts

📝 Walkthrough

Walkthrough

Added ledger picker-date tests for empty, bounded, and today-extended ranges, and updated several test files to import shared helpers through centralized aliases.

Changes

Test maintenance

Layer / File(s) Summary
Picker date behavior coverage
test/features/admin/ledger/picker-dates.test.ts
Adds coverage for empty transfers, date-range generation, selectable dates, and extending ranges through today.
Shared test helper imports
test/features/admin/attendee-page-data/refunds-ui.test.ts, test/features/api/..., test/shared/db/..., test/ui/templates/...
Redirects existing helper imports from local relative modules to shared aliases without changing test assertions or flows.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: moving nine misplaced unit tests to mirror their source paths.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/unit-tests-easy-wins-xlyi1a

Comment @coderabbitai help to get the list of available commands.

@stefan-burke
stefan-burke added this pull request to the merge queue Jul 12, 2026
Merged via the queue into main with commit 9d79098 Jul 12, 2026
3 checks passed
@stefan-burke
stefan-burke deleted the claude/unit-tests-easy-wins-xlyi1a branch July 12, 2026 09:54
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.

2 participants