Skip to content

Commit eea57ac

Browse files
committed
test(web): keep browser profile recorder test-local
1 parent 0ea04d1 commit eea57ac

1 file changed

Lines changed: 6 additions & 12 deletions

File tree

‎apps/web/src/components/RightPanelTabs.browserProfile.browser.test.tsx‎

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,10 @@ vi.mock("~/browser/browserDefaults", () => ({
1616

1717
import { RightPanelTabs } from "./RightPanelTabs";
1818

19-
let opened: string[];
20-
2119
// Records Browser opens the way ChatView's createBrowserSurface does: one
2220
// handler for the default open and the profile chooser, where an omitted
2321
// profile means the default one.
24-
function Harness() {
25-
const openBrowser = (profileId?: string) => {
26-
opened.push(profileId ?? DEFAULT_BROWSER_PROFILE_ID);
27-
};
22+
function Harness({ onOpen: openBrowser }: { onOpen: (profileId?: string) => void }) {
2823
return (
2924
<RightPanelTabs
3025
mode="inline"
@@ -94,7 +89,10 @@ async function click(element: Element) {
9489

9590
describe("opening Browser from the launcher", () => {
9691
it("opens the default profile from the row and another profile from the chooser", async () => {
97-
resetFixture();
92+
const opened: string[] = [];
93+
const onOpen = (profileId?: string) => {
94+
opened.push(profileId ?? DEFAULT_BROWSER_PROFILE_ID);
95+
};
9896
using _desktopBridge = stubGlobal("desktopBridge", { preview: {} });
9997
using _resizeObserver = stubGlobal(
10098
"ResizeObserver",
@@ -106,7 +104,7 @@ describe("opening Browser from the launcher", () => {
106104
);
107105
// The panel tabs do not use router hooks.
108106
await using screen = await renderScreen(null, { router: false });
109-
await screen.rerender(<Harness />);
107+
await screen.rerender(<Harness onOpen={onOpen} />);
110108

111109
await click(launcherRow(screen, "Browser"));
112110
expect(opened).toEqual([DEFAULT_BROWSER_PROFILE_ID]);
@@ -116,7 +114,3 @@ describe("opening Browser from the launcher", () => {
116114
expect(opened).toEqual([DEFAULT_BROWSER_PROFILE_ID, INCOGNITO_BROWSER_PROFILE_ID]);
117115
});
118116
});
119-
120-
function resetFixture() {
121-
opened = [];
122-
}

0 commit comments

Comments
 (0)