chore: update tests for parseArguments signature change

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
tanzhenxin 2026-02-06 13:05:49 +08:00
parent a4ffc6eb24
commit fcc98a30d5
2 changed files with 9 additions and 11 deletions

View file

@ -15,8 +15,6 @@ import type {
import { Config } from '@qwen-code/qwen-code-core'; import { Config } from '@qwen-code/qwen-code-core';
import { http, HttpResponse } from 'msw'; import { http, HttpResponse } from 'msw';
import { setupServer } from 'msw/node'; import { setupServer } from 'msw/node';
import type { Settings } from './settings.js';
export const server = setupServer(); export const server = setupServer();
// TODO(richieforeman): Consider moving this to test setup globally. // TODO(richieforeman): Consider moving this to test setup globally.
@ -271,7 +269,7 @@ describe('Configuration Integration Tests', () => {
'test', 'test',
]; ];
const argv = await parseArguments({} as Settings); const argv = await parseArguments();
// Verify that the argument was parsed correctly // Verify that the argument was parsed correctly
expect(argv.approvalMode).toBe('auto-edit'); expect(argv.approvalMode).toBe('auto-edit');
@ -295,7 +293,7 @@ describe('Configuration Integration Tests', () => {
'test', 'test',
]; ];
const argv = await parseArguments({} as Settings); const argv = await parseArguments();
expect(argv.approvalMode).toBe('plan'); expect(argv.approvalMode).toBe('plan');
expect(argv.prompt).toBe('test'); expect(argv.prompt).toBe('test');
@ -318,7 +316,7 @@ describe('Configuration Integration Tests', () => {
'test', 'test',
]; ];
const argv = await parseArguments({} as Settings); const argv = await parseArguments();
expect(argv.approvalMode).toBe('yolo'); expect(argv.approvalMode).toBe('yolo');
expect(argv.prompt).toBe('test'); expect(argv.prompt).toBe('test');
@ -341,7 +339,7 @@ describe('Configuration Integration Tests', () => {
'test', 'test',
]; ];
const argv = await parseArguments({} as Settings); const argv = await parseArguments();
expect(argv.approvalMode).toBe('default'); expect(argv.approvalMode).toBe('default');
expect(argv.prompt).toBe('test'); expect(argv.prompt).toBe('test');
@ -357,7 +355,7 @@ describe('Configuration Integration Tests', () => {
try { try {
process.argv = ['node', 'script.js', '--yolo', '-p', 'test']; process.argv = ['node', 'script.js', '--yolo', '-p', 'test'];
const argv = await parseArguments({} as Settings); const argv = await parseArguments();
expect(argv.yolo).toBe(true); expect(argv.yolo).toBe(true);
expect(argv.approvalMode).toBeUndefined(); // Should NOT be set when using --yolo expect(argv.approvalMode).toBeUndefined(); // Should NOT be set when using --yolo
@ -374,7 +372,7 @@ describe('Configuration Integration Tests', () => {
process.argv = ['node', 'script.js', '--approval-mode', 'invalid_mode']; process.argv = ['node', 'script.js', '--approval-mode', 'invalid_mode'];
// Should throw during argument parsing due to yargs validation // Should throw during argument parsing due to yargs validation
await expect(parseArguments({} as Settings)).rejects.toThrow(); await expect(parseArguments()).rejects.toThrow();
} finally { } finally {
process.argv = originalArgv; process.argv = originalArgv;
} }
@ -393,7 +391,7 @@ describe('Configuration Integration Tests', () => {
]; ];
// Should throw during argument parsing due to conflict validation // Should throw during argument parsing due to conflict validation
await expect(parseArguments({} as Settings)).rejects.toThrow(); await expect(parseArguments()).rejects.toThrow();
} finally { } finally {
process.argv = originalArgv; process.argv = originalArgv;
} }
@ -406,7 +404,7 @@ describe('Configuration Integration Tests', () => {
// Test that no approval mode arguments defaults to no flags set // Test that no approval mode arguments defaults to no flags set
process.argv = ['node', 'script.js', '-p', 'test']; process.argv = ['node', 'script.js', '-p', 'test'];
const argv = await parseArguments({} as Settings); const argv = await parseArguments();
expect(argv.approvalMode).toBeUndefined(); expect(argv.approvalMode).toBeUndefined();
expect(argv.yolo).toBe(false); expect(argv.yolo).toBe(false);

View file

@ -2061,7 +2061,7 @@ describe('loadCliConfig fileFiltering', () => {
fileFiltering: { [property]: value }, fileFiltering: { [property]: value },
}, },
}; };
const argv = await parseArguments(settings); const argv = await parseArguments();
const config = await loadCliConfig(settings, argv, undefined, []); const config = await loadCliConfig(settings, argv, undefined, []);
expect(getter(config)).toBe(value); expect(getter(config)).toBe(value);
}, },