reduce tooltip delay for all tests

This commit is contained in:
Athou
2025-03-02 19:18:27 +01:00
parent 937e7353ce
commit 4ecefe6491
2 changed files with 6 additions and 3 deletions

View File

@@ -12,9 +12,6 @@ vi.mock("@lingui/react", () => ({
}))
vi.mock("hooks/useActionButton")
// reduce delay for faster tests
vi.mock("app/constants", () => ({ Constants: { tooltip: { delay: 10 } } }))
const label = "Test Label"
const icon = "Test Icon"
describe("ActionButton", () => {

View File

@@ -1,6 +1,12 @@
import "@testing-library/jest-dom"
import { Constants } from "app/constants"
import { vi } from "vitest"
// reduce delay for faster tests
Constants.tooltip.delay = 10
// jsdom doesn't mock matchMedia
// https://stackoverflow.com/a/53449595/
Object.defineProperty(window, "matchMedia", {
writable: true,
value: vi.fn().mockImplementation(query => ({