mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-28 04:32:35 -07:00
test: optimize useSelectionList tests with fake timers
This commit is contained in:
@@ -38,6 +38,7 @@ describe('useSelectionList', () => {
|
||||
];
|
||||
|
||||
beforeEach(() => {
|
||||
vi.useFakeTimers();
|
||||
activeKeypressHandler = null;
|
||||
vi.spyOn(useKeypressModule, 'useKeypress').mockImplementation(
|
||||
(handler: KeypressHandler, options?: UseKeypressMockOptions) => {
|
||||
@@ -52,6 +53,10 @@ describe('useSelectionList', () => {
|
||||
mockOnHighlight.mockClear();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.useRealTimers();
|
||||
});
|
||||
|
||||
const pressKey = (
|
||||
name: string,
|
||||
sequence: string = name,
|
||||
@@ -530,14 +535,6 @@ describe('useSelectionList', () => {
|
||||
});
|
||||
|
||||
describe('Numeric Quick Selection (showNumbers=true)', () => {
|
||||
beforeEach(() => {
|
||||
vi.useFakeTimers();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.useRealTimers();
|
||||
});
|
||||
|
||||
const shortList = items;
|
||||
const longList: Array<SelectionListItem<string>> = Array.from(
|
||||
{ length: 15 },
|
||||
|
||||
Reference in New Issue
Block a user