mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-29 14:34:55 -07:00
Update persistence state to track counts of messages instead of times banner has been displayed (#13428)
This commit is contained in:
@@ -8,6 +8,7 @@ import { renderWithProviders } from '../../test-utils/render.js';
|
||||
import { AppHeader } from './AppHeader.js';
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
||||
import { makeFakeConfig } from '@google/gemini-cli-core';
|
||||
import crypto from 'node:crypto';
|
||||
|
||||
const persistentStateMock = vi.hoisted(() => ({
|
||||
get: vi.fn(),
|
||||
@@ -25,7 +26,7 @@ vi.mock('../utils/terminalSetup.js', () => ({
|
||||
describe('<AppHeader />', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
persistentStateMock.get.mockReturnValue(0);
|
||||
persistentStateMock.get.mockReturnValue({});
|
||||
});
|
||||
|
||||
it('should render the banner with default text', () => {
|
||||
@@ -146,8 +147,8 @@ describe('<AppHeader />', () => {
|
||||
unmount();
|
||||
});
|
||||
|
||||
it('should increment the shown count when default banner is displayed', () => {
|
||||
persistentStateMock.get.mockReturnValue(0);
|
||||
it('should increment the version count when default banner is displayed', () => {
|
||||
persistentStateMock.get.mockReturnValue({});
|
||||
const mockConfig = makeFakeConfig();
|
||||
const uiState = {
|
||||
bannerData: {
|
||||
@@ -163,7 +164,12 @@ describe('<AppHeader />', () => {
|
||||
|
||||
expect(persistentStateMock.set).toHaveBeenCalledWith(
|
||||
'defaultBannerShownCount',
|
||||
1,
|
||||
{
|
||||
[crypto
|
||||
.createHash('sha256')
|
||||
.update(uiState.bannerData.defaultText)
|
||||
.digest('hex')]: 1,
|
||||
},
|
||||
);
|
||||
unmount();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user