Skip to content

Commit b185c14

Browse files
Tighten test fixtures for terminal options and event typing
- Pass subprocess test options only when defined in `terminalManager` tests - Narrow web store terminal event fixtures to `started`/`activity` event shapes
1 parent b529328 commit b185c14

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

‎apps/server/src/terminalManager.test.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,10 @@ describe("TerminalManager", () => {
151151
ptyAdapter,
152152
historyLineLimit,
153153
shellResolver: options.shellResolver ?? (() => "/bin/bash"),
154-
subprocessChecker: options.subprocessChecker,
155-
subprocessPollIntervalMs: options.subprocessPollIntervalMs,
154+
...(options.subprocessChecker ? { subprocessChecker: options.subprocessChecker } : {}),
155+
...(options.subprocessPollIntervalMs
156+
? { subprocessPollIntervalMs: options.subprocessPollIntervalMs }
157+
: {}),
156158
});
157159
return { logsDir, ptyAdapter, manager };
158160
}

‎apps/web/src/store.test.ts‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import { type AppState, reducer } from "./store";
55
import { DEFAULT_THREAD_TERMINAL_HEIGHT, DEFAULT_THREAD_TERMINAL_ID } from "./types";
66
import type { Thread } from "./types";
77

8+
type TerminalStartedEvent = Extract<TerminalEvent, { type: "started" }>;
9+
type TerminalActivityEvent = Extract<TerminalEvent, { type: "activity" }>;
10+
811
function makeSession(overrides: Partial<ProviderSession> = {}): ProviderSession {
912
return {
1013
sessionId: "sess-1",
@@ -76,7 +79,9 @@ function makeState(thread: Thread): AppState {
7679
};
7780
}
7881

79-
function makeTerminalStartedEvent(overrides: Partial<TerminalEvent> = {}): TerminalEvent {
82+
function makeTerminalStartedEvent(
83+
overrides: Partial<TerminalStartedEvent> = {},
84+
): TerminalStartedEvent {
8085
return {
8186
type: "started",
8287
threadId: "thread-local-1",
@@ -97,7 +102,9 @@ function makeTerminalStartedEvent(overrides: Partial<TerminalEvent> = {}): Termi
97102
};
98103
}
99104

100-
function makeTerminalActivityEvent(overrides: Partial<TerminalEvent> = {}): TerminalEvent {
105+
function makeTerminalActivityEvent(
106+
overrides: Partial<TerminalActivityEvent> = {},
107+
): TerminalActivityEvent {
101108
return {
102109
type: "activity",
103110
threadId: "thread-local-1",

0 commit comments

Comments
 (0)