mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-26 04:54:25 -07:00
refactor: Update Card tests to use renderWithProviders and add new card states
This commit is contained in:
@@ -4,11 +4,11 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { render } from '../../../test-utils/render.js';
|
import { renderWithProviders } from '../../../test-utils/render.js';
|
||||||
import { Card } from './Card.js';
|
import { Card } from './Card.js';
|
||||||
import { Text } from 'ink';
|
import { Text } from 'ink';
|
||||||
import { describe, it, expect, afterEach, vi } from 'vitest';
|
import { describe, it, expect, afterEach, vi } from 'vitest';
|
||||||
import { ToolCallStatus } from '../../types.js';
|
import { ToolCallStatus, StreamingState } from '../../types.js';
|
||||||
|
|
||||||
describe('Card', () => {
|
describe('Card', () => {
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -51,6 +51,20 @@ describe('Card', () => {
|
|||||||
showStatusIndicator: true,
|
showStatusIndicator: true,
|
||||||
body: 'Listed 39 item(s).',
|
body: 'Listed 39 item(s).',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
status: ToolCallStatus.Executing,
|
||||||
|
title: 'Searching',
|
||||||
|
suffix: 'ripgrep',
|
||||||
|
showStatusIndicator: true,
|
||||||
|
body: 'Searching for pattern in directory...',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
status: ToolCallStatus.Pending,
|
||||||
|
title: 'No Status Indicator',
|
||||||
|
suffix: 'Hidden',
|
||||||
|
showStatusIndicator: false,
|
||||||
|
body: 'The status indicator should be hidden.',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
status: ToolCallStatus.Pending,
|
status: ToolCallStatus.Pending,
|
||||||
title: 'Fixed Width Card',
|
title: 'Fixed Width Card',
|
||||||
@@ -62,7 +76,7 @@ describe('Card', () => {
|
|||||||
] as const)(
|
] as const)(
|
||||||
"renders '$title' card with status=$status and showStatusIndicator=$showStatusIndicator",
|
"renders '$title' card with status=$status and showStatusIndicator=$showStatusIndicator",
|
||||||
({ status, title, suffix, showStatusIndicator, body, width }) => {
|
({ status, title, suffix, showStatusIndicator, body, width }) => {
|
||||||
const { lastFrame } = render(
|
const { lastFrame } = renderWithProviders(
|
||||||
<Card
|
<Card
|
||||||
status={status}
|
status={status}
|
||||||
title={title}
|
title={title}
|
||||||
@@ -72,6 +86,11 @@ describe('Card', () => {
|
|||||||
>
|
>
|
||||||
<Text>{body}</Text>
|
<Text>{body}</Text>
|
||||||
</Card>,
|
</Card>,
|
||||||
|
{
|
||||||
|
uiState: {
|
||||||
|
streamingState: StreamingState.Responding,
|
||||||
|
},
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
const output = lastFrame();
|
const output = lastFrame();
|
||||||
|
|||||||
Reference in New Issue
Block a user