mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-21 02:24:09 -07:00
Code review fixes for show question mark pr. (#18480)
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2025 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import { describe, it, expect, afterEach, vi } from 'vitest';
|
||||
import { renderWithProviders } from '../../test-utils/render.js';
|
||||
import { ShortcutsHelp } from './ShortcutsHelp.js';
|
||||
|
||||
describe('ShortcutsHelp', () => {
|
||||
const originalPlatform = process.platform;
|
||||
|
||||
afterEach(() => {
|
||||
Object.defineProperty(process, 'platform', {
|
||||
value: originalPlatform,
|
||||
});
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
const testCases = [
|
||||
{ name: 'wide', width: 100 },
|
||||
{ name: 'narrow', width: 40 },
|
||||
];
|
||||
|
||||
const platforms = [
|
||||
{ name: 'mac', value: 'darwin' },
|
||||
{ name: 'linux', value: 'linux' },
|
||||
] as const;
|
||||
|
||||
it.each(
|
||||
platforms.flatMap((platform) =>
|
||||
testCases.map((testCase) => ({ ...testCase, platform })),
|
||||
),
|
||||
)(
|
||||
'renders correctly in $name mode on $platform.name',
|
||||
({ width, platform }) => {
|
||||
Object.defineProperty(process, 'platform', {
|
||||
value: platform.value,
|
||||
});
|
||||
|
||||
const { lastFrame } = renderWithProviders(<ShortcutsHelp />, {
|
||||
width,
|
||||
});
|
||||
expect(lastFrame()).toContain('shell mode');
|
||||
expect(lastFrame()).toMatchSnapshot();
|
||||
},
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user