Disable tips after 10 runs (#17101)

This commit is contained in:
Adib234
2026-01-22 15:46:18 -05:00
committed by GitHub
parent 5d68d8cda5
commit 016a94ffaf
11 changed files with 327 additions and 91 deletions

View File

@@ -4,12 +4,15 @@
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect, vi } from 'vitest';
import {
renderWithProviders,
persistentStateMock,
} from '../../test-utils/render.js';
import { describe, it, expect, vi, beforeEach } from 'vitest';
import { AlternateBufferQuittingDisplay } from './AlternateBufferQuittingDisplay.js';
import { ToolCallStatus } from '../types.js';
import type { HistoryItem, HistoryItemWithoutId } from '../types.js';
import { Text } from 'ink';
import { renderWithProviders } from '../../test-utils/render.js';
import type { Config } from '@google/gemini-cli-core';
vi.mock('../utils/terminalSetup.js', () => ({
@@ -98,6 +101,9 @@ const mockConfig = {
} as unknown as Config;
describe('AlternateBufferQuittingDisplay', () => {
beforeEach(() => {
vi.clearAllMocks();
});
const baseUIState = {
terminalWidth: 80,
mainAreaWidth: 80,
@@ -112,6 +118,7 @@ describe('AlternateBufferQuittingDisplay', () => {
};
it('renders with active and pending tool messages', () => {
persistentStateMock.setData({ tipsShown: 0 });
const { lastFrame } = renderWithProviders(
<AlternateBufferQuittingDisplay />,
{
@@ -127,6 +134,7 @@ describe('AlternateBufferQuittingDisplay', () => {
});
it('renders with empty history and no pending items', () => {
persistentStateMock.setData({ tipsShown: 0 });
const { lastFrame } = renderWithProviders(
<AlternateBufferQuittingDisplay />,
{
@@ -142,6 +150,7 @@ describe('AlternateBufferQuittingDisplay', () => {
});
it('renders with history but no pending items', () => {
persistentStateMock.setData({ tipsShown: 0 });
const { lastFrame } = renderWithProviders(
<AlternateBufferQuittingDisplay />,
{
@@ -157,6 +166,7 @@ describe('AlternateBufferQuittingDisplay', () => {
});
it('renders with pending items but no history', () => {
persistentStateMock.setData({ tipsShown: 0 });
const { lastFrame } = renderWithProviders(
<AlternateBufferQuittingDisplay />,
{
@@ -172,6 +182,7 @@ describe('AlternateBufferQuittingDisplay', () => {
});
it('renders with user and gemini messages', () => {
persistentStateMock.setData({ tipsShown: 0 });
const history: HistoryItem[] = [
{ id: 1, type: 'user', text: 'Hello Gemini' },
{ id: 2, type: 'gemini', text: 'Hello User!' },