Files
gemini-cli/packages/cli/src/ui/utils/TableRenderer.test.tsx
T

35 lines
1001 B
TypeScript
Raw Normal View History

/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect } from 'vitest';
import { TableRenderer } from './TableRenderer.js';
import { renderWithProviders } from '../../test-utils/render.js';
describe('TableRenderer', () => {
it('renders a 3x3 table correctly', () => {
const headers = ['Header 1', 'Header 2', 'Header 3'];
const rows = [
['Row 1, Col 1', 'Row 1, Col 2', 'Row 1, Col 3'],
['Row 2, Col 1', 'Row 2, Col 2', 'Row 2, Col 3'],
['Row 3, Col 1', 'Row 3, Col 2', 'Row 3, Col 3'],
];
const terminalWidth = 80;
const { lastFrame } = renderWithProviders(
<TableRenderer
headers={headers}
rows={rows}
terminalWidth={terminalWidth}
/>,
);
const output = lastFrame();
expect(output).toContain('Header 1');
expect(output).toContain('Row 1, Col 1');
expect(output).toContain('Row 3, Col 3');
expect(output).toMatchSnapshot();
});
});