mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-15 22:33:05 -07:00
test(cli): use fake timers in render.test.tsx
This commit is contained in:
@@ -4,13 +4,21 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import { describe, it, expect, vi } from 'vitest';
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
||||
import { useState, useEffect, act } from 'react';
|
||||
import { Text } from 'ink';
|
||||
import { renderHook, render } from './render.js';
|
||||
import { waitFor } from './async.js';
|
||||
|
||||
describe.sequential('render', () => {
|
||||
beforeEach(() => {
|
||||
vi.useFakeTimers();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.useRealTimers();
|
||||
});
|
||||
|
||||
it('should render a component', async () => {
|
||||
const { lastFrame, unmount } = await render(<Text>Hello World</Text>);
|
||||
expect(lastFrame()).toBe('Hello World\n');
|
||||
|
||||
Reference in New Issue
Block a user