From b35081759f876382e038715d4473638311e0e157 Mon Sep 17 00:00:00 2001 From: "A.K.M. Adib" Date: Tue, 20 Jan 2026 12:21:26 -0500 Subject: [PATCH] restore snapshot and fix tests --- .../AlternateBufferQuittingDisplay.test.tsx | 11 +++++++++++ packages/cli/src/ui/components/AppHeader.test.tsx | 12 +++++++++++- .../components/__snapshots__/AppHeader.test.tsx.snap | 7 ++++++- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/ui/components/AlternateBufferQuittingDisplay.test.tsx b/packages/cli/src/ui/components/AlternateBufferQuittingDisplay.test.tsx index c487357081..223a797b0b 100644 --- a/packages/cli/src/ui/components/AlternateBufferQuittingDisplay.test.tsx +++ b/packages/cli/src/ui/components/AlternateBufferQuittingDisplay.test.tsx @@ -12,6 +12,17 @@ import { Text } from 'ink'; import { renderWithProviders } from '../../test-utils/render.js'; import type { Config } from '@google/gemini-cli-core'; +vi.mock('../../utils/persistentState.js', () => ({ + persistentState: { + get: vi.fn().mockImplementation((key) => { + if (key === 'tipsShown') return false; + if (key === 'defaultBannerShownCount') return {}; + return undefined; + }), + set: vi.fn(), + }, +})); + vi.mock('../utils/terminalSetup.js', () => ({ getTerminalProgram: () => null, })); diff --git a/packages/cli/src/ui/components/AppHeader.test.tsx b/packages/cli/src/ui/components/AppHeader.test.tsx index 4833432823..2648ac57ca 100644 --- a/packages/cli/src/ui/components/AppHeader.test.tsx +++ b/packages/cli/src/ui/components/AppHeader.test.tsx @@ -133,7 +133,17 @@ describe('', () => { }); it('should not render the default banner if shown count is 5 or more', () => { - persistentStateMock.get.mockReturnValue(5); + persistentStateMock.get.mockImplementation((key) => { + if (key === 'defaultBannerShownCount') { + const hash = crypto + .createHash('sha256') + .update('This is the default banner') + .digest('hex'); + return { [hash]: 5 }; + } + return undefined; + }); + const mockConfig = makeFakeConfig(); const uiState = { history: [], diff --git a/packages/cli/src/ui/components/__snapshots__/AppHeader.test.tsx.snap b/packages/cli/src/ui/components/__snapshots__/AppHeader.test.tsx.snap index debf83b38b..6da8b523f2 100644 --- a/packages/cli/src/ui/components/__snapshots__/AppHeader.test.tsx.snap +++ b/packages/cli/src/ui/components/__snapshots__/AppHeader.test.tsx.snap @@ -46,7 +46,12 @@ exports[` > should not render the default banner if shown count is ███░ ░░███ ░░███ ███░ ░░█████████ ░░░ ░░░░░░░░░ -" + +Tips for getting started: +1. Ask questions, edit files, or run commands. +2. Be specific for the best results. +3. Create GEMINI.md files to customize your interactions with Gemini. +4. /help for more information." `; exports[` > should render the banner when previewFeatures is disabled 1`] = `