mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-10 22:41:14 +00:00
Fix TemperatureControl test flake (#5045)
This commit is contained in:
parent
ae885d64e0
commit
0a8c55cbd2
1 changed files with 9 additions and 7 deletions
|
|
@ -1,6 +1,6 @@
|
|||
// npx vitest src/components/settings/__tests__/TemperatureControl.spec.tsx
|
||||
|
||||
import { render, screen, fireEvent } from "@testing-library/react"
|
||||
import { render, screen, fireEvent, waitFor } from "@testing-library/react"
|
||||
|
||||
import { TemperatureControl } from "../TemperatureControl"
|
||||
|
||||
|
|
@ -64,16 +64,18 @@ describe("TemperatureControl", () => {
|
|||
// Uncheck - should clear temperature.
|
||||
fireEvent.click(checkbox)
|
||||
|
||||
// Waiting for debounce.
|
||||
await new Promise((x) => setTimeout(x, 100))
|
||||
expect(onChange).toHaveBeenCalledWith(null)
|
||||
// Wait for debounced onChange call.
|
||||
await waitFor(() => {
|
||||
expect(onChange).toHaveBeenCalledWith(null)
|
||||
})
|
||||
|
||||
// Check - should restore previous temperature.
|
||||
fireEvent.click(checkbox)
|
||||
|
||||
// Waiting for debounce.
|
||||
await new Promise((x) => setTimeout(x, 100))
|
||||
expect(onChange).toHaveBeenCalledWith(0.7)
|
||||
// Wait for debounced onChange call.
|
||||
await waitFor(() => {
|
||||
expect(onChange).toHaveBeenCalledWith(0.7)
|
||||
})
|
||||
})
|
||||
|
||||
it("syncs checkbox state when value prop changes", () => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue