Migrate tests to use avoid jsdom (#12118)

This commit is contained in:
Jacob Richman
2025-10-28 10:32:15 -07:00
committed by GitHub
parent 5d61adf804
commit 13aa0148e7
31 changed files with 765 additions and 579 deletions
@@ -4,9 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
/** @vitest-environment jsdom */
import { render, cleanup } from '@testing-library/react';
import { render, cleanup } from 'ink-testing-library';
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import {
DEFAULT_GEMINI_FLASH_LITE_MODEL,
@@ -82,12 +80,12 @@ describe('<ModelDialog />', () => {
});
it('renders the title and help text', () => {
const { getByText } = renderComponent();
expect(getByText('Select Model')).toBeDefined();
expect(getByText('(Press Esc to close)')).toBeDefined();
expect(
getByText('> To use a specific Gemini model, use the --model flag.'),
).toBeDefined();
const { lastFrame } = renderComponent();
expect(lastFrame()).toContain('Select Model');
expect(lastFrame()).toContain('(Press Esc to close)');
expect(lastFrame()).toContain(
'> To use a specific Gemini model, use the --model flag.',
);
});
it('passes all model options to DescriptiveRadioButtonSelect', () => {