Skip to content

Commit ed23b6c

Browse files
committed
test: cover empty workbench overlay state
1 parent c713145 commit ed23b6c

2 files changed

Lines changed: 48 additions & 3 deletions

File tree

apps/web/src/state/workbench-core.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,7 @@ export const normalizeWorkbenchState = (input: Partial<WorkbenchState> | null |
435435
...fallback,
436436
overlay: {
437437
...fallback.overlay,
438+
...input?.overlay,
438439
visible: false,
439440
},
440441
};
@@ -447,6 +448,7 @@ export const normalizeWorkbenchState = (input: Partial<WorkbenchState> | null |
447448
...fallback,
448449
overlay: {
449450
...fallback.overlay,
451+
...input.overlay,
450452
visible: false,
451453
},
452454
};

tests/workspace-welcome-screen.test.ts

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
normalizeWorkbenchState,
55
} from "../apps/web/src/state/workbench-core.ts";
66
import {
7+
applyWorkbenchUiState,
78
buildWorkbenchStateFromBootstrap,
89
} from "../apps/web/src/shared/utils/workspace.ts";
910
import {
@@ -15,13 +16,16 @@ test("empty workbench state does not auto-open the launch overlay", () => {
1516
tabs: [],
1617
overlay: {
1718
visible: true,
18-
mode: "local",
19-
input: "",
20-
target: { type: "native" },
19+
mode: "remote",
20+
input: "ssh://demo",
21+
target: { type: "wsl", distro: "Ubuntu" },
2122
},
2223
});
2324

2425
assert.equal(normalized.overlay.visible, false);
26+
assert.equal(normalized.overlay.mode, "remote");
27+
assert.equal(normalized.overlay.input, "ssh://demo");
28+
assert.deepEqual(normalized.overlay.target, { type: "wsl", distro: "Ubuntu" });
2529
});
2630

2731
test("bootstrap with zero open workspaces keeps the launch overlay hidden", () => {
@@ -64,3 +68,42 @@ test("bootstrap with zero open workspaces keeps the launch overlay hidden", () =
6468
assert.equal(next.tabs.length, 0);
6569
assert.equal(next.overlay.visible, false);
6670
});
71+
72+
test("ui state with zero open workspaces keeps the launch overlay hidden", () => {
73+
const next = applyWorkbenchUiState(
74+
{
75+
tabs: [],
76+
activeTabId: "",
77+
layout: {
78+
leftWidth: 320,
79+
rightWidth: 320,
80+
rightSplit: 64,
81+
showCodePanel: true,
82+
showTerminalPanel: true,
83+
},
84+
overlay: {
85+
visible: false,
86+
mode: "remote",
87+
input: "ssh://demo",
88+
target: { type: "wsl", distro: "Ubuntu" },
89+
},
90+
},
91+
{
92+
open_workspace_ids: [],
93+
active_workspace_id: null,
94+
layout: {
95+
left_width: 320,
96+
right_width: 320,
97+
right_split: 64,
98+
show_code_panel: true,
99+
show_terminal_panel: true,
100+
},
101+
},
102+
);
103+
104+
assert.equal(next.tabs.length, 0);
105+
assert.equal(next.overlay.visible, false);
106+
assert.equal(next.overlay.mode, "remote");
107+
assert.equal(next.overlay.input, "ssh://demo");
108+
assert.deepEqual(next.overlay.target, { type: "wsl", distro: "Ubuntu" });
109+
});

0 commit comments

Comments
 (0)