summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/hooks/shellCommandProcessor.test.ts
diff options
context:
space:
mode:
authorOlcan <[email protected]>2025-05-30 01:35:03 -0700
committerGitHub <[email protected]>2025-05-30 01:35:03 -0700
commita3b557222a95965de39920922df21439d69def57 (patch)
treeb2f5fd038a10f0ea659829658d2355c6bbe20941 /packages/cli/src/ui/hooks/shellCommandProcessor.test.ts
parent094b9dc474fd8b99813acfa53e1192058314e9e4 (diff)
tweaks to shell abort logic based on feedback (#618)
Diffstat (limited to 'packages/cli/src/ui/hooks/shellCommandProcessor.test.ts')
-rw-r--r--packages/cli/src/ui/hooks/shellCommandProcessor.test.ts22
1 files changed, 13 insertions, 9 deletions
diff --git a/packages/cli/src/ui/hooks/shellCommandProcessor.test.ts b/packages/cli/src/ui/hooks/shellCommandProcessor.test.ts
index 92bc98ea..2fd32087 100644
--- a/packages/cli/src/ui/hooks/shellCommandProcessor.test.ts
+++ b/packages/cli/src/ui/hooks/shellCommandProcessor.test.ts
@@ -105,9 +105,10 @@ describe('useShellCommandProcessor', () => {
it('should return false for non-string input', () => {
const { result } = setupHook();
- const handled = result.current.handleShellCommand([
- { text: 'not a string' },
- ] as PartListUnion);
+ const handled = result.current.handleShellCommand(
+ [{ text: 'not a string' }] as PartListUnion,
+ new AbortController().signal,
+ );
expect(handled).toBe(false);
expect(mockAddItemToHistory).not.toHaveBeenCalled();
});
@@ -115,7 +116,10 @@ describe('useShellCommandProcessor', () => {
it('should handle empty shell command', () => {
const { result } = setupHook();
act(() => {
- const handled = result.current.handleShellCommand('');
+ const handled = result.current.handleShellCommand(
+ '',
+ new AbortController().signal,
+ );
expect(handled).toBe(true);
});
expect(mockAddItemToHistory).toHaveBeenNthCalledWith(
@@ -144,7 +148,7 @@ describe('useShellCommandProcessor', () => {
existsSyncSpy.mockReturnValue(false);
await act(async () => {
- result.current.handleShellCommand(command);
+ result.current.handleShellCommand(command, new AbortController().signal);
await new Promise(process.nextTick);
});
@@ -182,7 +186,7 @@ describe('useShellCommandProcessor', () => {
existsSyncSpy.mockReturnValue(false);
await act(async () => {
- result.current.handleShellCommand(command);
+ result.current.handleShellCommand(command, new AbortController().signal);
await new Promise(process.nextTick);
});
expect(mockAddItemToHistory).toHaveBeenNthCalledWith(
@@ -210,7 +214,7 @@ describe('useShellCommandProcessor', () => {
existsSyncSpy.mockReturnValue(false);
await act(async () => {
- result.current.handleShellCommand(command);
+ result.current.handleShellCommand(command, new AbortController().signal);
await new Promise(process.nextTick);
});
expect(mockAddItemToHistory).toHaveBeenNthCalledWith(
@@ -237,7 +241,7 @@ describe('useShellCommandProcessor', () => {
existsSyncSpy.mockReturnValue(false);
await act(async () => {
- result.current.handleShellCommand(command);
+ result.current.handleShellCommand(command, new AbortController().signal);
await new Promise(process.nextTick);
});
expect(mockAddItemToHistory).toHaveBeenNthCalledWith(
@@ -264,7 +268,7 @@ describe('useShellCommandProcessor', () => {
existsSyncSpy.mockReturnValue(false);
await act(async () => {
- result.current.handleShellCommand(command);
+ result.current.handleShellCommand(command, new AbortController().signal);
await new Promise(process.nextTick);
});