import { afterAll, beforeAll, expect, mock, test } from "bun:test";
import { GlobalRegistrator } from "@happy-dom/global-registrator";
import { act, type ReactNode } from "react";
import { createRoot as createReactRoot } from "react-dom/client";
import { AppContext, type AppContextValue } from "../../app-context";
import type { Session } from "../../types";
// The header only renders inside the session shell, which always has the app
// context; its chat actions (copy link, pin) run through it. This test runs
// none of them, so any read of the context fails loudly.
const appContext = new Proxy({} as AppContextValue, {
get(_target, key) {
throw new Error(`The SessionHeader mute test's app context has no ${String(key)}`);
},
});
function createRoot(container: Element) {
const root = createReactRoot(container);
return {
render: (node: ReactNode) =>
root.render({node}),
unmount: () => root.unmount(),
};
}
// The menu's items, rendered inline so the test reads what the person sees.
mock.module("../../../ui/dropdown-menu", () => ({
DropdownMenu: ({ children }: { children: ReactNode }) =>
{children}
,
DropdownMenuTrigger: ({ children }: { children: ReactNode }) =>
{children}
,
DropdownMenuContent: ({ children }: { children: ReactNode }) =>