Skip to content

Commit b6fea72

Browse files
committed
Drain React before the self-host banner test takes the document away
The Dismiss save settles a render after the last test returns, and afterAll unregistered happy-dom first, so the render fired against a missing document and bun reported an unhandled error between tests: zero failures, a red job. afterAll now awaits settleReactWork first, as the other React tests do.
1 parent 3e614dd commit b6fea72

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎app/tests/self-host-banner.test.tsx‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
test,
88
} from "bun:test";
99
import { GlobalRegistrator } from "@happy-dom/global-registrator";
10+
import type { UserPreferences } from "@openbot/shared/user-preferences";
1011
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
1112
import { cleanup, fireEvent, render, waitFor } from "@testing-library/react";
1213
import {
@@ -16,7 +17,7 @@ import {
1617
import { authKeys } from "@/lib/auth/queries";
1718
import { deploymentKeys } from "@/lib/deployment/queries";
1819
import { userPreferencesQueryOptions } from "@/lib/settings/message-list";
19-
import type { UserPreferences } from "@openbot/shared/user-preferences";
20+
import { settleReactWork } from "./settle-react-work";
2021

2122
const originalFetch = globalThis.fetch;
2223
const clients: QueryClient[] = [];
@@ -50,7 +51,11 @@ afterEach(() => {
5051
clients.length = 0;
5152
globalThis.fetch = originalFetch;
5253
});
53-
afterAll(() => GlobalRegistrator.unregister());
54+
afterAll(async () => {
55+
// See settle-react-work.ts: the Dismiss save settles a render after the last test returns.
56+
await settleReactWork();
57+
GlobalRegistrator.unregister();
58+
});
5459

5560
const banner = { name: "Self-host OpenBot" } as const;
5661

0 commit comments

Comments
 (0)