mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
fix: failed unit tests
This commit is contained in:
@@ -339,7 +339,7 @@ describe('AuthDialog', () => {
|
|||||||
|
|
||||||
// Should show error message instead of calling onSelect
|
// Should show error message instead of calling onSelect
|
||||||
expect(lastFrame()).toContain(
|
expect(lastFrame()).toContain(
|
||||||
'You must select an auth method to proceed. Press Ctrl+C twice to exit.',
|
'You must select an auth method to proceed. Press Ctrl+C again to exit.',
|
||||||
);
|
);
|
||||||
expect(onSelect).not.toHaveBeenCalled();
|
expect(onSelect).not.toHaveBeenCalled();
|
||||||
unmount();
|
unmount();
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ async function createMockConfig(
|
|||||||
getTool: vi.fn(),
|
getTool: vi.fn(),
|
||||||
getFunctionDeclarations: vi.fn().mockReturnValue([]),
|
getFunctionDeclarations: vi.fn().mockReturnValue([]),
|
||||||
getFunctionDeclarationsFiltered: vi.fn().mockReturnValue([]),
|
getFunctionDeclarationsFiltered: vi.fn().mockReturnValue([]),
|
||||||
|
getAllToolNames: vi.fn().mockReturnValue([]),
|
||||||
...toolRegistryMocks,
|
...toolRegistryMocks,
|
||||||
} as unknown as ToolRegistry;
|
} as unknown as ToolRegistry;
|
||||||
|
|
||||||
@@ -86,6 +87,8 @@ const createMockStream = (
|
|||||||
if (response === 'stop') {
|
if (response === 'stop') {
|
||||||
// When stopping, the model might return text, but the subagent logic primarily cares about the absence of functionCalls.
|
// When stopping, the model might return text, but the subagent logic primarily cares about the absence of functionCalls.
|
||||||
yield {
|
yield {
|
||||||
|
type: 'chunk',
|
||||||
|
value: {
|
||||||
candidates: [
|
candidates: [
|
||||||
{
|
{
|
||||||
content: {
|
content: {
|
||||||
@@ -93,11 +96,19 @@ const createMockStream = (
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
},
|
||||||
};
|
};
|
||||||
} else if (response.length > 0) {
|
} else if (response.length > 0) {
|
||||||
yield { functionCalls: response };
|
yield {
|
||||||
|
type: 'chunk',
|
||||||
|
value: {
|
||||||
|
functionCalls: response,
|
||||||
|
},
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
yield {
|
yield {
|
||||||
|
type: 'chunk',
|
||||||
|
value: {
|
||||||
candidates: [
|
candidates: [
|
||||||
{
|
{
|
||||||
content: {
|
content: {
|
||||||
@@ -105,6 +116,7 @@ const createMockStream = (
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
},
|
||||||
}; // Handle empty array also as stop
|
}; // Handle empty array also as stop
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -66,8 +66,8 @@ describe('FileSearch', () => {
|
|||||||
|
|
||||||
expect(results).toEqual([
|
expect(results).toEqual([
|
||||||
'src/',
|
'src/',
|
||||||
'.qwenignore',
|
|
||||||
'.gitignore',
|
'.gitignore',
|
||||||
|
'.qwenignore',
|
||||||
'src/not-ignored.js',
|
'src/not-ignored.js',
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user