Skip to content

test(web): split CommentsPanelTests, AccessibleNamesTests and PlayStatsTests under the 400-line limit (0.6.0 #268) - #283

Merged
mwg-bender[bot] merged 1 commit into
devfrom
wt/t_c3bad67e
Nov 28, 2026
Merged

mwg-bender[bot] merged 1 commit into
devfrom
wt/t_c3bad67e

Conversation

@mwg-bender

@mwg-bender mwg-bender Bot commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Summary

#268 item 5 (#205 story 2): three Web test files over the 400-line rule in AGENTS.md, split by behaviour. No test is added, removed, renamed or changed. Every [TestMethod] block, with its comments and attributes, moves byte for byte.

 MW-GC.EventManager.Web.Tests/
-├── CommentsPanelTests.cs                  644  (all of it)
+├── CommentsPanelFixture.cs                108  abstract: stub API, Comments a/b, tags, Open/OpenDetails, responses
+├── CommentsPanelTests.cs                  101  the list: order, dates, empty, loading, failed load
+├── CommentsPanelAddTests.cs               118  add, blank/too long, API's messages, failed add
+├── CommentsPanelEditAndDeleteTests.cs     134  edit, refused edit, cancel, one at a time, failed save, delete
+├── CommentsPanelStaleEditTests.cs         113  409 on edit/delete, 404 on edit, own tag per Comment
+├── CommentsPanelBusyGuardTests.cs          76  second click while a request runs
+├── CommentsPanelDiscardTests.cs            54  dirty add box / dirty edit asks to discard
-├── AccessibleNamesTests.cs                524  (all of it)
+├── AccessibleNamesFixture.cs               93  abstract: library, Event, Open/OpenDialog/Row
+├── AccessibleNamesTests.cs                294  names, toggles, pickers, dialog headings, tags, h1/tab title
+├── FocusReturnTests.cs                    157  every dialog returns focus to its opener
-├── PlayStatsTests.cs                      402  (all of it)
+├── PlayStatsFixture.cs                     65  abstract: fixed clock, library, Event/Pick/Compute/Metrics/Measures
+├── PlayStatsTests.cs                      212  offered, wins, deleted rows, names, order
+└── PlayStatsActivityPerformanceTests.cs   144  #136 win rate, average Likes, average attendees

Each family shares its state and helpers through one abstract fixture, the pattern CommentsFromEventDetailsFixture and DialogSafetyFixture already use. Nothing is copied. The helpers are instance members over per-test state (api, harness, the Comments, the library), so an internal static class could not hold them without passing that state on every call. Static view helpers stay where they were (CommentsPanelView, PageActions).

Evidence

Base origin/dev 6d7f2c6 (the card expected ea40dc0; dev moved by #280 while this ran: FeedbackLinkCopyTests.cs and EventDetailsDialog.razor, outside scope. Rebased cleanly, and every number below is from the new tip). Cold builds (clean-build.sh):

base 6d7f2c6 head
build errors / warnings 0 / 0 0 / 0
Api.Tests 911 passed + 2 skipped (913) 911 passed + 2 skipped (913)
Web.Tests 1260 passed 1260 passed
E2E (no stack) 5 passed + 14 skipped (19) 5 passed + 14 skipped (19)
  • Sorted --list-tests names, base vs head: diff is empty (exit 0).
  • Sorted names of all 1260 executed results (TRX), base vs head: diff is empty (exit 0). The TRX list is added because --list-tests prints one line fewer than the run's total on both sides.
  • Test blocks: all 74 [TestMethod] blocks of the three files at base reappear exactly once across the 10 test files, byte for byte (0 missing, 0 new or changed).
  • Mutation, one flipped assertion per original file, each in a moved test. Each went red, then green after restore:
    • CommentsPanelStaleEditTests.SavingCommentAThenCommentB_SendsEachCommentsOwnTag: expected TagB -> TagA: Failed
    • FocusReturnTests.DeleteConfirmed_RestoresFocusAfterTheDelete: expected delete count 1 -> 2: Failed
    • PlayStatsActivityPerformanceTests.WinRate_IsWinsDividedByOffered: expected 0.25m -> 0.5m: Failed
  • UI flows: NOT RUN by the worker. The change is test-only, no production file is touched, and the card names no live run.

Merge Danger

Door: two-way. Only test files move.

Blast Radius: tests. No production code, no .github/, no other test file. SlotPlannerTests and SlotRerollTests are left to their parallel card.

Notes

Closes #268, as the card says. It takes effect when dev reaches main, and Nerd closes the issue by hand. The SlotPlannerTests and SlotRerollTests part of item 5 is on a parallel card, so check that card before closing #268.

…tsTests under the 400-line limit (0.6.0 #268)

AGENTS.md keeps a source file under about 400 lines, and #268 item 5 (#205
story 2) lists three Web test files past it. Each is split by the behaviour
its tests cover. No test is added, removed, renamed or changed: every
[TestMethod] block, with its comments and attributes, moves byte for byte.

- CommentsPanelTests (644 lines) keeps the list tests; the add, edit and
  delete, stale-edit, busy-guard and discard tests move to
  CommentsPanelAddTests, CommentsPanelEditAndDeleteTests,
  CommentsPanelStaleEditTests, CommentsPanelBusyGuardTests and
  CommentsPanelDiscardTests.
- AccessibleNamesTests (524 lines) keeps the names, toggles, headings, tags
  and page-title tests; the focus-return tests move to FocusReturnTests.
- PlayStatsTests (402 lines) keeps offered, wins, names and order; the
  Activity performance section (#136) moves to
  PlayStatsActivityPerformanceTests.

The shared state and helpers of each family live in one abstract fixture
(CommentsPanelFixture, AccessibleNamesFixture, PlayStatsFixture), the
pattern CommentsFromEventDetailsFixture and DialogSafetyFixture already use,
so nothing is copied. Every touched file is now at most 294 lines.

Closes #268
@github-actions

Copy link
Copy Markdown

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
2173 2173 0 0 0 0 1m 17s

🎉 No failed tests in this run.

Github Test Reporter by CTRF 💚

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.

0 participants