test: support tests that include color information (#20220)

This commit is contained in:
Jacob Richman
2026-02-25 15:31:35 -08:00
committed by GitHub
parent 78dfe9dea8
commit f9f916e1dc
68 changed files with 2342 additions and 492 deletions

View File

@@ -6,7 +6,7 @@
import { act } from 'react';
import type { EventEmitter } from 'node:events';
import { render } from '../../test-utils/render.js';
import { renderWithProviders } from '../../test-utils/render.js';
import { waitFor } from '../../test-utils/async.js';
import { ConfigInitDisplay } from './ConfigInitDisplay.js';
import {
@@ -27,7 +27,7 @@ import {
import { Text } from 'ink';
// Mock GeminiSpinner
vi.mock('./GeminiRespondingSpinner.js', () => ({
vi.mock('./GeminiSpinner.js', () => ({
GeminiSpinner: () => <Text>Spinner</Text>,
}));
@@ -43,7 +43,9 @@ describe('ConfigInitDisplay', () => {
});
it('renders initial state', async () => {
const { lastFrame, waitUntilReady } = render(<ConfigInitDisplay />);
const { lastFrame, waitUntilReady } = renderWithProviders(
<ConfigInitDisplay />,
);
await waitUntilReady();
expect(lastFrame()).toMatchSnapshot();
});
@@ -57,7 +59,7 @@ describe('ConfigInitDisplay', () => {
return coreEvents;
});
const { lastFrame } = render(<ConfigInitDisplay />);
const { lastFrame } = renderWithProviders(<ConfigInitDisplay />);
// Wait for listener to be registered
await waitFor(() => {
@@ -95,7 +97,7 @@ describe('ConfigInitDisplay', () => {
return coreEvents;
});
const { lastFrame } = render(<ConfigInitDisplay />);
const { lastFrame } = renderWithProviders(<ConfigInitDisplay />);
await waitFor(() => {
if (!listener) throw new Error('Listener not registered yet');
@@ -131,7 +133,7 @@ describe('ConfigInitDisplay', () => {
return coreEvents;
});
const { lastFrame } = render(<ConfigInitDisplay />);
const { lastFrame } = renderWithProviders(<ConfigInitDisplay />);
await waitFor(() => {
if (!listener) throw new Error('Listener not registered yet');