Fix failing tests in @packages/cli/src/gemini.test.tsx

- Add missing config methods: getUsageStatisticsEnabled, getSessionId, getOutputFormat
- Fix stdin TTY setting for stream-json mode to ensure correct code path execution
- Fix duplicate key definition issue

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
mingholy.lmh 2026-03-03 17:36:54 +08:00
parent 7679910f26
commit b8eccc4a4f

View file

@ -262,7 +262,7 @@ describe('gemini.tsx main function', () => {
'isRaw',
);
Object.defineProperty(process.stdin, 'isTTY', {
value: true,
value: false, // 在 stream-json 模式下应为 false
configurable: true,
});
Object.defineProperty(process.stdin, 'isRaw', {
@ -344,6 +344,9 @@ describe('gemini.tsx main function', () => {
getInputFormat: () => 'stream-json',
getContentGeneratorConfig: () => ({ authType: 'test-auth' }),
getWarnings: () => [],
getUsageStatisticsEnabled: () => true,
getSessionId: () => 'test-session-id',
getOutputFormat: () => OutputFormat.TEXT,
} as unknown as Config;
vi.mocked(loadCliConfig).mockResolvedValue(configStub);
@ -442,6 +445,7 @@ describe('gemini.tsx main function kitty protocol', () => {
getScreenReader: () => false,
getGeminiMdFileCount: () => 0,
getWarnings: () => [],
getUsageStatisticsEnabled: () => true,
} as unknown as Config);
vi.mocked(loadSettings).mockReturnValue({
errors: [],