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
This commit is contained in:
1 parent
ddc4a93c36
commit
804572c8ff
2 files changed
+13
-4
No files matched your search
@@ -151,8 +151,10 @@ describe("TerminalManager", () => {
|
||||
ptyAdapter,
|
||||
historyLineLimit,
|
||||
shellResolver: options.shellResolver ?? (() => "/bin/bash"),
|
||||
subprocessChecker: options.subprocessChecker,
|
||||
subprocessPollIntervalMs: options.subprocessPollIntervalMs,
|
||||
...(options.subprocessChecker ? { subprocessChecker: options.subprocessChecker } : {}),
|
||||
...(options.subprocessPollIntervalMs
|
||||
? { subprocessPollIntervalMs: options.subprocessPollIntervalMs }
|
||||
: {}),
|
||||
});
|
||||
return { logsDir, ptyAdapter, manager };
|
||||
}
|
||||
|
||||
@@ -5,6 +5,9 @@ import { type AppState, reducer } from "./store";
|
||||
import { DEFAULT_THREAD_TERMINAL_HEIGHT, DEFAULT_THREAD_TERMINAL_ID } from "./types";
|
||||
import type { Thread } from "./types";
|
||||
|
||||
type TerminalStartedEvent = Extract<TerminalEvent, { type: "started" }>;
|
||||
type TerminalActivityEvent = Extract<TerminalEvent, { type: "activity" }>;
|
||||
|
||||
function makeSession(overrides: Partial<ProviderSession> = {}): ProviderSession {
|
||||
return {
|
||||
sessionId: "sess-1",
|
||||
@@ -76,7 +79,9 @@ function makeState(thread: Thread): AppState {
|
||||
};
|
||||
}
|
||||
|
||||
function makeTerminalStartedEvent(overrides: Partial<TerminalEvent> = {}): TerminalEvent {
|
||||
function makeTerminalStartedEvent(
|
||||
overrides: Partial<TerminalStartedEvent> = {},
|
||||
): TerminalStartedEvent {
|
||||
return {
|
||||
type: "started",
|
||||
threadId: "thread-local-1",
|
||||
@@ -97,7 +102,9 @@ function makeTerminalStartedEvent(overrides: Partial<TerminalEvent> = {}): Termi
|
||||
};
|
||||
}
|
||||
|
||||
function makeTerminalActivityEvent(overrides: Partial<TerminalEvent> = {}): TerminalEvent {
|
||||
function makeTerminalActivityEvent(
|
||||
overrides: Partial<TerminalActivityEvent> = {},
|
||||
): TerminalActivityEvent {
|
||||
return {
|
||||
type: "activity",
|
||||
threadId: "thread-local-1",
|
||||
|
||||
Reference in new issue
Block a user