Skip to content

Commit 430ac9f

Browse files
committed
fix tests
1 parent 41767d2 commit 430ac9f

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

tests/unit/useSearchHighlightAndScrollTest.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -332,12 +332,9 @@ describe('useSearchHighlightAndScroll', () => {
332332
expect(result.current.newSearchResultKeys?.size).toBe(1);
333333
expect([...(result.current.newSearchResultKeys ?? new Set())]).toContain('transactions_3');
334334

335-
// Wait 1s for the timer in useSearchHighlightAndScroll to complete.
336-
await new Promise((resolve) => {
337-
setTimeout(resolve, 1000);
338-
});
339-
340-
expect(spyOnMergeTransactionIdsHighlightOnSearchRoute).toHaveBeenCalledTimes(1);
335+
// The hook now clears the consumed manual highlight flag synchronously inside the
336+
// detect effect (right after `setNewSearchResultKeys`), instead of via a timer.
337+
// No need to wait — the merge has already fired by the time `rerender` returns.
341338
expect(spyOnMergeTransactionIdsHighlightOnSearchRoute).toHaveBeenCalledWith(baseProps.queryJSON.type, {'3': false});
342339
});
343340

0 commit comments

Comments
 (0)