mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-07-18 14:00:27 -07:00
35 lines
1001 B
TypeScript
35 lines
1001 B
TypeScript
|
|
/**
|
||
|
|
* @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();
|
||
|
|
});
|
||
|
|
});
|