Skip to content

Commit e0b78cc

Browse files
committed
Fix hanging tests
I am not really sure what ws.connected is doing but it seems to somehow block updates. Basically, the useEffect creating the terminal never updates when the config loads, so the web socket is never created, and the test hangs forever. Before I think it worked because the web socket did not block on the terminal being created, but we need the terminal first so we can get the size and spawn with the right height/width to avoid a screen bug.
1 parent b1a6d85 commit e0b78cc

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

site/src/pages/TerminalPage/TerminalPage.test.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ describe("TerminalPage", () => {
127127
const { container } = await renderTerminal();
128128

129129
// Then
130-
await ws.connected;
130+
await ws.nextMessage;
131131
ws.send(text);
132132
await expectTerminalText(container, text);
133133
ws.close();
@@ -143,7 +143,6 @@ describe("TerminalPage", () => {
143143
await renderTerminal();
144144

145145
// Then
146-
await ws.connected;
147146
const msg = await ws.nextMessage;
148147
const req = JSON.parse(new TextDecoder().decode(msg as Uint8Array));
149148
expect(req.height).toBeGreaterThan(0);
@@ -164,7 +163,7 @@ describe("TerminalPage", () => {
164163
);
165164

166165
// Then
167-
await ws.connected;
166+
await ws.nextMessage;
168167
ws.send(text);
169168
await expectTerminalText(container, text);
170169
ws.close();

0 commit comments

Comments
 (0)