Skip to content

Commit 50a3247

Browse files
committed
test(server): cover sibling data URLs with the test clock
1 parent 1e1e223 commit 50a3247

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

‎apps/server/src/preview/ServerBrowser.test.ts‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1236,10 +1236,16 @@ it.live.each([false, true])(
12361236
).pipe(Effect.provide(layer)),
12371237
);
12381238

1239-
it.live("a tab showing a data: page reports its URL without the content", () =>
1239+
it.effect("a tab showing a data: page reports its URL without the content", () =>
12401240
Effect.scoped(
12411241
Effect.gen(function* () {
12421242
const { broker, tabId } = yield* ready;
1243+
const sibling = yield* broker.invoke<PreviewAutomationStatus>({
1244+
scope: asSession("agent-b"),
1245+
operation: "open",
1246+
input: { reuseExistingTab: false, show: false },
1247+
});
1248+
yield* Effect.promise(() => contexts[1]!.page.goto("data:text/html,<p>SIBLING-SECRET</p>"));
12431249
const manager = yield* Manager.PreviewManager;
12441250
const events = yield* manager.subscribeEvents;
12451251
yield* Effect.promise(() => contexts[0]!.page.goto("data:text/html,<p>SECRET-KEY</p>"));
@@ -1260,7 +1266,11 @@ it.live("a tab showing a data: page reports its URL without the content", () =>
12601266
expect(event.snapshot.navStatus).toMatchObject({ url: "data:text/html,…" });
12611267
expect(status.url).toBe("data:text/html,…");
12621268
expect(status.tabs?.find((entry) => entry.tabId === tabId)?.url).toBe("data:text/html,…");
1269+
expect(status.tabs?.find((entry) => entry.tabId === sibling.tabId)?.url).toBe(
1270+
"data:text/html,…",
1271+
);
12631272
expect(JSON.stringify([event, status])).not.toContain("SECRET-KEY");
1273+
expect(JSON.stringify([event, status])).not.toContain("SIBLING-SECRET");
12641274
}),
12651275
).pipe(Effect.provide(layer)),
12661276
);

0 commit comments

Comments
 (0)