Derive stats tab section titles from the component - #834
Merged
Conversation
d88f4f1 split the "User Settings" table into "Settings by Session" and "Settings by User", but the spec kept its own copy of the section titles and still asserted the old name, so it failed. Rather than retype the new names into the test, the tab now declares its tables once as a SECTIONS list the template loops over, and exports the titles. The spec compares the rendered captions to that export, so a rename cannot leave a stale copy behind again. The assertion is the whole ordered caption list rather than a containment check per title. With the titles derived, containment would pass vacuously; comparing the list still catches a section that stops rendering, one rendered twice, or an empty title. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Problem
frontend/tests/unit/stats-tab.test.jsfailed. ItsSECTION_TITLESlist still named aUser Settingssection that no longer exists. Commit d88f4f1 split that table intoSettings by SessionandSettings by User, and the spec's private copy of the titles went stale.Fix
The tab now declares its tables once, as a
SECTIONSlist of caption and computed-name pairs that the template loops over, and exports the titles. The spec imports that export instead of restating the names, so renaming a section can no longer strand a copy in the test.The template comments about the API key and the two settings denominators moved onto their entries in the list.
Assertion strength
With the titles derived, a
toContainloop would pass vacuously, so the test now compares the full ordered list of rendered captions against the export. Blanking one section's title makes it fail, which I verified before restoring the file.Verification
vitest run tests/unit/stats-tab.test.js: 7 passedvitest run: 46 files, 447 tests passedmake fixthenbun run lint: clean, no unrelated files touched🤖 Generated with Claude Code