restore snapshot and fix tests

This commit is contained in:
A.K.M. Adib
2026-01-20 12:21:26 -05:00
parent 783f5b9461
commit b35081759f
3 changed files with 28 additions and 2 deletions

View File

@@ -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,
}));

View File

@@ -133,7 +133,17 @@ describe('<AppHeader />', () => {
});
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: [],

View File

@@ -46,7 +46,12 @@ exports[`<AppHeader /> > 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[`<AppHeader /> > should render the banner when previewFeatures is disabled 1`] = `