mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-14 08:01:02 -07:00
36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
/**
|
|
* @license
|
|
* Copyright 2025 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import { render } from 'ink-testing-library';
|
|
import type React from 'react';
|
|
import { LoadedSettings } from '../config/settings.js';
|
|
import { KeypressProvider } from '../ui/contexts/KeypressContext.js';
|
|
import { SettingsContext } from '../ui/contexts/SettingsContext.js';
|
|
import { ShellFocusContext } from '../ui/contexts/ShellFocusContext.js';
|
|
|
|
const mockSettings = new LoadedSettings(
|
|
{ path: '', settings: {}, originalSettings: {} },
|
|
{ path: '', settings: {}, originalSettings: {} },
|
|
{ path: '', settings: {}, originalSettings: {} },
|
|
{ path: '', settings: {}, originalSettings: {} },
|
|
true,
|
|
new Set(),
|
|
);
|
|
|
|
export const renderWithProviders = (
|
|
component: React.ReactElement,
|
|
{ shellFocus = true, settings = mockSettings } = {},
|
|
): ReturnType<typeof render> =>
|
|
render(
|
|
<SettingsContext.Provider value={settings}>
|
|
<ShellFocusContext.Provider value={shellFocus}>
|
|
<KeypressProvider kittyProtocolEnabled={true}>
|
|
{component}
|
|
</KeypressProvider>
|
|
</ShellFocusContext.Provider>
|
|
</SettingsContext.Provider>,
|
|
);
|