feat: added unit tests#2539
Conversation
Greptile SummaryAdds a Vitest-based unit-testing setup.
Confidence Score: 4/5The PR appears safe to merge, but CI should run the new suite and the quick-tools test should assert intended cleanup behavior instead of preserving a known defect. The test setup and assertions are generally consistent with the implementations, while the accepted concerns affect the suite’s automated enforcement and the maintainability of one defective behavior rather than production execution. Files Needing Attention: package.json; tests/unit/quickToolsState.test.js Important Files Changed
Reviews (1): Last reviewed commit: "feat: added unit tests" | Re-trigger Greptile |
| "test": "vitest run", | ||
| "test:watch": "vitest" |
| it("skips containers that match themselves", () => { | ||
| // The implementation marks each container as visited before checking | ||
| // whether the container itself matches, so the self-match branch never | ||
| // clears it. This pins the current behavior. | ||
| const container = fakeContainer([], true); | ||
| container.dataset = { timeout: "456" }; | ||
| container.classList = fakeButton(["active"]).classList; | ||
|
|
||
| expect(clearQuickToolsButtonFeedback([container])).toBe(0); | ||
| }); |
There was a problem hiding this comment.
Test preserves defective cleanup
This test explicitly pins the behavior where a matching container retains active feedback. Correcting the cleanup implementation to clear that container will therefore fail the regression suite and encourage preservation of stale UI state.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
No description provided.