import "@testing-library/jest-dom/vitest";
import { lazy } from "react";
import { act, cleanup, render, screen } from "@testing-library/react";
import { afterEach, describe, expect, it, vi } from "vitest";
import { LazyContent } from "../src/components/LazyContent";
afterEach(() => {
cleanup();
vi.restoreAllMocks();
});
describe("LazyContent", () => {
it("keeps the surrounding app shell visible while a feature chunk loads", async () => {
let resolveModule: ((module: { default: () => React.JSX.Element }) => void) | undefined;
const Feature = lazy(
() =>
new Promise<{ default: () => React.JSX.Element }>((resolve) => {
resolveModule = resolve;
})
);
render(
Watermaps
Modul fehlt.
} >Modul konnte nicht geladen werden.
} >