fix(cli): resolve merge conflicts and align with async test helpers

This commit is contained in:
Keith Guerin
2026-03-20 20:32:27 -07:00
parent 511cbc54c9
commit 4b2c117af3
3 changed files with 22 additions and 4 deletions
@@ -5,13 +5,13 @@
*/
import * as Core from '@google/gemini-cli-core';
import { vi, describe, it, expect, beforeEach } from 'vitest';
import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest';
import { compressCommand } from './compressCommand.js';
import { createMockCommandContext } from '../../test-utils/mockCommandContext.js';
import { MessageType } from '../types.js';
vi.mock('@google/gemini-cli-core', async (importOriginal) => {
const actual = (await importOriginal()) as Record<string, unknown>;
const actual = (await importOriginal()) as any;
return {
...actual,
tokenLimit: vi.fn(),
@@ -22,6 +22,10 @@ describe('compressCommand', () => {
let context: ReturnType<typeof createMockCommandContext>;
let mockTryCompressChat: ReturnType<typeof vi.fn>;
afterEach(() => {
vi.restoreAllMocks();
});
beforeEach(() => {
mockTryCompressChat = vi.fn();
vi.mocked(Core.tokenLimit).mockReturnValue(1000);
@@ -77,8 +77,7 @@ export const compressCommand: SlashCommand = {
beforePercentage,
afterPercentage,
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
compressionStatus:
Number(compressed.compressionStatus) as unknown as CompressionStatus,
compressionStatus: Number(compressed.compressionStatus) as unknown as CompressionStatus,
isManual: true,
thresholdPercentage: Math.round(threshold * 100),
},
@@ -44,6 +44,7 @@ import {
type CompressionStatus,
>>>>>>> 12bc9cace (fix(cli): resolve merge conflicts and align with async test helpers)
Kind,
<<<<<<< HEAD
ACTIVATE_SKILL_TOOL_NAME,
=======
CompressionStatus,
@@ -62,6 +63,20 @@ import type {
ToolCallResponseInfo,
GeminiErrorEventValue,
RetryAttemptPayload,
=======
type Config,
type EditorType,
type GeminiClient,
type ServerGeminiChatCompressedEvent,
type ServerGeminiContentEvent as ContentEvent,
type ServerGeminiFinishedEvent,
type ServerGeminiStreamEvent as GeminiEvent,
type ThoughtSummary,
type ToolCallRequestInfo,
type ToolCallResponseInfo,
type GeminiErrorEventValue,
type RetryAttemptPayload,
>>>>>>> 17740dc2d (fix(cli): resolve merge conflicts and align with async test helpers)
} from '@google/gemini-cli-core';
import { type Part, type PartListUnion, FinishReason } from '@google/genai';
import type {