Fix watchdog callout test act helper

This commit is contained in:
Dotta committed 2026-06-24 21:49:32 +00:00
1 parent fc2af3841b
commit 80481f7fc9
1 file changed
+9 -1
@@ -1,7 +1,7 @@
// @vitest-environment jsdom
import { act } from "react";
import type { ComponentProps, ReactNode } from "react";
import { flushSync } from "react-dom";
import { createRoot, type Root } from "react-dom/client";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
@@ -33,6 +33,14 @@ vi.mock("@/api/issues", () => ({
let container: HTMLDivElement;
let root: Root;
function act(callback: () => void | Promise<void>) {
let result: void | Promise<void> | undefined;
flushSync(() => {
result = callback();
});
return result;
}
const summary: IssueWatchdogSummary = {
id: "wd-1",
companyId: "co-1",