Skip to content

Commit f3338cb

Browse files
test(web): await preview and syntax highlighting resources
1 parent 00d63dd commit f3338cb

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

‎apps/web/src/components/chat/WorkflowOpeningBlock.browser.test.tsx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { createRoot, type Root } from "react-dom/client";
55
import { afterEach, beforeEach, expect, it, vi } from "vite-plus/test";
66

77
import "~/index.css";
8+
import { getSyntaxHighlighterPromise } from "../../lib/syntaxHighlighting";
89

910
import { AppAtomRegistryProvider } from "../../rpc/atomRegistry";
1011
import { MarkdownFindContext } from "./markdownFindContext";
@@ -99,6 +100,9 @@ const foldToggle = () =>
99100

100101
it("shows a short script as highlighted code with nothing to open", async () => {
101102
await render(SHORT_SCRIPT);
103+
await act(async () => {
104+
await getSyntaxHighlighterPromise("javascript");
105+
});
102106
expect(host.querySelector('[data-language="javascript"]')?.textContent).toContain("SCRIPTONLY");
103107
await vi.waitFor(() => expect(host.querySelector(".chat-markdown-shiki")).not.toBeNull());
104108
expect(foldToggle()).toBeUndefined();

‎apps/web/src/components/files/AttachmentFilePreview.browser.test.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ describe("attachment HTML preview recovery", () => {
6969
expect(container.querySelector("iframe")?.getAttribute("src")).toBe(originalUrl);
7070
now = 61 * 60_000;
7171
await toggleMode("Show HTML source");
72+
await act(async () => {
73+
await import("./ReadOnlySourcePreview");
74+
});
7275
expect(fetch).toHaveBeenCalledExactlyOnceWith(renewedUrl, expect.any(Object));
7376
await vi.waitFor(() =>
7477
expect(container.querySelector("pre")?.textContent).toBe("<p>Captured HTML</p>"),

0 commit comments

Comments
 (0)