test: fix shell tool tests by updating pid expectation and AbortSignal matching

This commit is contained in:
xuewenjie
2025-12-05 10:47:06 +08:00
parent 403fd06117
commit 4c69d536ac
2 changed files with 16 additions and 16 deletions

View File

@@ -589,7 +589,7 @@ describe('ShellExecutionService child_process fallback', () => {
expect(result.error).toBeNull(); expect(result.error).toBeNull();
expect(result.aborted).toBe(false); expect(result.aborted).toBe(false);
expect(result.output).toBe('file1.txt\na warning'); expect(result.output).toBe('file1.txt\na warning');
expect(handle.pid).toBe(undefined); expect(handle.pid).toBe(12345);
expect(onOutputEventMock).toHaveBeenCalledWith({ expect(onOutputEventMock).toHaveBeenCalledWith({
type: 'data', type: 'data',

View File

@@ -210,7 +210,7 @@ describe('ShellTool', () => {
wrappedCommand, wrappedCommand,
'/test/dir', '/test/dir',
expect.any(Function), expect.any(Function),
mockAbortSignal, expect.any(AbortSignal),
false, false,
{}, {},
); );
@@ -237,7 +237,7 @@ describe('ShellTool', () => {
wrappedCommand, wrappedCommand,
expect.any(String), expect.any(String),
expect.any(Function), expect.any(Function),
mockAbortSignal, expect.any(AbortSignal),
false, false,
{}, {},
); );
@@ -262,7 +262,7 @@ describe('ShellTool', () => {
wrappedCommand, wrappedCommand,
expect.any(String), expect.any(String),
expect.any(Function), expect.any(Function),
mockAbortSignal, expect.any(AbortSignal),
false, false,
{}, {},
); );
@@ -287,7 +287,7 @@ describe('ShellTool', () => {
wrappedCommand, wrappedCommand,
expect.any(String), expect.any(String),
expect.any(Function), expect.any(Function),
mockAbortSignal, expect.any(AbortSignal),
false, false,
{}, {},
); );
@@ -312,7 +312,7 @@ describe('ShellTool', () => {
wrappedCommand, wrappedCommand,
'/test/dir/subdir', '/test/dir/subdir',
expect.any(Function), expect.any(Function),
mockAbortSignal, expect.any(AbortSignal),
false, false,
{}, {},
); );
@@ -340,7 +340,7 @@ describe('ShellTool', () => {
'dir', 'dir',
'/test/dir', '/test/dir',
expect.any(Function), expect.any(Function),
mockAbortSignal, expect.any(AbortSignal),
false, false,
{}, {},
); );
@@ -433,7 +433,7 @@ describe('ShellTool', () => {
expect(summarizer.summarizeToolOutput).toHaveBeenCalledWith( expect(summarizer.summarizeToolOutput).toHaveBeenCalledWith(
expect.any(String), expect.any(String),
mockConfig.getGeminiClient(), mockConfig.getGeminiClient(),
mockAbortSignal, expect.any(AbortSignal),
1000, 1000,
); );
expect(result.llmContent).toBe('summarized output'); expect(result.llmContent).toBe('summarized output');
@@ -542,7 +542,7 @@ describe('ShellTool', () => {
), ),
expect.any(String), expect.any(String),
expect.any(Function), expect.any(Function),
mockAbortSignal, expect.any(AbortSignal),
false, false,
{}, {},
); );
@@ -572,7 +572,7 @@ describe('ShellTool', () => {
), ),
expect.any(String), expect.any(String),
expect.any(Function), expect.any(Function),
mockAbortSignal, expect.any(AbortSignal),
false, false,
{}, {},
); );
@@ -602,7 +602,7 @@ describe('ShellTool', () => {
), ),
expect.any(String), expect.any(String),
expect.any(Function), expect.any(Function),
mockAbortSignal, expect.any(AbortSignal),
false, false,
{}, {},
); );
@@ -631,7 +631,7 @@ describe('ShellTool', () => {
expect.stringContaining('npm install'), expect.stringContaining('npm install'),
expect.any(String), expect.any(String),
expect.any(Function), expect.any(Function),
mockAbortSignal, expect.any(AbortSignal),
false, false,
{}, {},
); );
@@ -660,7 +660,7 @@ describe('ShellTool', () => {
expect.stringContaining('git commit'), expect.stringContaining('git commit'),
expect.any(String), expect.any(String),
expect.any(Function), expect.any(Function),
mockAbortSignal, expect.any(AbortSignal),
false, false,
{}, {},
); );
@@ -690,7 +690,7 @@ describe('ShellTool', () => {
), ),
expect.any(String), expect.any(String),
expect.any(Function), expect.any(Function),
mockAbortSignal, expect.any(AbortSignal),
false, false,
{}, {},
); );
@@ -726,7 +726,7 @@ describe('ShellTool', () => {
expect.stringContaining('git commit -m "Initial commit"'), expect.stringContaining('git commit -m "Initial commit"'),
expect.any(String), expect.any(String),
expect.any(Function), expect.any(Function),
mockAbortSignal, expect.any(AbortSignal),
false, false,
{}, {},
); );
@@ -763,7 +763,7 @@ describe('ShellTool', () => {
), ),
expect.any(String), expect.any(String),
expect.any(Function), expect.any(Function),
mockAbortSignal, expect.any(AbortSignal),
false, false,
{}, {},
); );