From a3024f3eed26cf78426233d93c3b24ecc1a19e03 Mon Sep 17 00:00:00 2001 From: mkorwel Date: Mon, 20 Apr 2026 22:09:14 +0000 Subject: [PATCH] test: optimize useSelectionList tests with fake timers --- packages/cli/src/ui/hooks/useSelectionList.test.tsx | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/packages/cli/src/ui/hooks/useSelectionList.test.tsx b/packages/cli/src/ui/hooks/useSelectionList.test.tsx index ca110ce06d..1eae4c9bac 100644 --- a/packages/cli/src/ui/hooks/useSelectionList.test.tsx +++ b/packages/cli/src/ui/hooks/useSelectionList.test.tsx @@ -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> = Array.from( { length: 15 },