-
-
Notifications
You must be signed in to change notification settings - Fork 35
tsk-midukh [OPEN] Add vitest coverage for the Crosswords app #2076
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -66,7 +66,7 @@ describe("CrosswordsApp", () => { | |||||||
| expect(within(firstCell).queryByText("S")).toBeNull(); | ||||||||
| }); | ||||||||
|
|
||||||||
| it("navigates to a clue's starting cell and direction when the clue is clicked", async () => { | ||||||||
| it("navigates to a clue\'s starting cell and direction when the clue is clicked", async () => { | ||||||||
| render(<CrosswordsApp windowId="win-cw-4" />); | ||||||||
| await flush(); | ||||||||
|
|
||||||||
|
|
@@ -82,4 +82,26 @@ describe("CrosswordsApp", () => { | |||||||
| const activeClueItem = screen.getByRole("button", { name: /1 across: celestial objects/i }); | ||||||||
| expect(activeClueItem).toHaveStyle({ background: "rgba(251, 191, 36, 0.25)" }); | ||||||||
| }); | ||||||||
|
|
||||||||
| it("clicks check answers button to enter check mode", async () => { | ||||||||
| render(<CrosswordsApp windowId="win-cw-5" />); | ||||||||
| await flush(); | ||||||||
|
|
||||||||
| const checkButton = screen.getByRole("button", { name: /check answers/i }); | ||||||||
| fireEvent.click(checkButton); | ||||||||
| await flush(); | ||||||||
|
|
||||||||
| expect(checkButton).toBeInTheDocument(); | ||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔥 The Roast: This test clicks the "Check Answers" button and then... asserts the button still exists. That's like checking if a light switch is still on the wall after you flip it. It verifies exactly zero behavior — no check mode entered, no answers validated, no UI state change confirmed. It's a participation trophy of a test. 🩹 The Fix:
Suggested change
📏 Severity: warning Reply with |
||||||||
| }); | ||||||||
|
|
||||||||
| it("switches to next puzzle", async () => { | ||||||||
| render(<CrosswordsApp windowId="win-cw-6" />); | ||||||||
| await flush(); | ||||||||
|
|
||||||||
| const newPuzzleButton = screen.getByRole("button", { name: /new puzzle/i }); | ||||||||
| fireEvent.click(newPuzzleButton); | ||||||||
| await flush(); | ||||||||
|
|
||||||||
| expect(screen.getByText(/crossword #2/i)).toBeTruthy(); | ||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔥 The Roast: The test clicks "New Puzzle" and checks for "Crossword #2" text. Better than the previous one, but still fragile — it only verifies text content, not that the grid actually reset, clues changed, or the previous puzzle state was cleaned up. What if the text is hardcoded and the grid still shows puzzle #1? 🩹 The Fix:
Suggested change
📏 Severity: suggestion Reply with |
||||||||
| }); | ||||||||
| }); | ||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥 The Roast: Using
fireEvent.clickinstead ofuserEvent.clickfrom@testing-library/user-event.fireEventdoesn't simulate real browser events (no focus, no selection changes, no proper event propagation). It's the fast-food version of user interaction — looks like a click, digests like regret.🩹 The Fix:
📏 Severity: suggestion
Reply with
@kilocode-bot fix itto have Kilo Code address this issue.