From 5708e5f3e2685512ba3af093430500cb32b49954 Mon Sep 17 00:00:00 2001 From: Keith Guerin Date: Tue, 10 Feb 2026 00:46:24 -0800 Subject: [PATCH] feat(cli): prepend Tip: to informative tips in loading area --- packages/cli/src/ui/hooks/useLoadingIndicator.test.tsx | 8 +++++--- packages/cli/src/ui/hooks/usePhraseCycler.test.tsx | 6 +++++- packages/cli/src/ui/hooks/usePhraseCycler.ts | 5 ++++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/packages/cli/src/ui/hooks/useLoadingIndicator.test.tsx b/packages/cli/src/ui/hooks/useLoadingIndicator.test.tsx index e0ae9b5f20..c4bd9857d6 100644 --- a/packages/cli/src/ui/hooks/useLoadingIndicator.test.tsx +++ b/packages/cli/src/ui/hooks/useLoadingIndicator.test.tsx @@ -107,9 +107,11 @@ describe('useLoadingIndicator', () => { ); // Initially should be witty phrase or tip - expect([...WITTY_LOADING_PHRASES, ...INFORMATIVE_TIPS]).toContain( - result.current.currentLoadingPhrase, - ); + const possiblePhrases = [ + ...WITTY_LOADING_PHRASES, + ...INFORMATIVE_TIPS.map((tip) => `Tip: ${tip}`), + ]; + expect(possiblePhrases).toContain(result.current.currentLoadingPhrase); await act(async () => { rerender({ diff --git a/packages/cli/src/ui/hooks/usePhraseCycler.test.tsx b/packages/cli/src/ui/hooks/usePhraseCycler.test.tsx index ca89c623ac..c79d82c463 100644 --- a/packages/cli/src/ui/hooks/usePhraseCycler.test.tsx +++ b/packages/cli/src/ui/hooks/usePhraseCycler.test.tsx @@ -141,7 +141,11 @@ describe('usePhraseCycler', () => { await waitUntilReady(); // Initial phrase on first activation should be a tip - expect(INFORMATIVE_TIPS).toContain(lastFrame().trim()); + await act(async () => { + await vi.advanceTimersByTimeAsync(0); + }); + expect(lastFrame()?.startsWith('Tip: ')).toBe(true); + expect(INFORMATIVE_TIPS).toContain(lastFrame()!.replace('Tip: ', '')); // After the first interval, it should be a witty phrase await act(async () => { diff --git a/packages/cli/src/ui/hooks/usePhraseCycler.ts b/packages/cli/src/ui/hooks/usePhraseCycler.ts index 8ddab6eef9..6f9dd0a066 100644 --- a/packages/cli/src/ui/hooks/usePhraseCycler.ts +++ b/packages/cli/src/ui/hooks/usePhraseCycler.ts @@ -89,7 +89,10 @@ export const usePhraseCycler = ( } const randomIndex = Math.floor(Math.random() * phraseList.length); - setCurrentLoadingPhrase(phraseList[randomIndex]); + const phrase = phraseList[randomIndex]; + setCurrentLoadingPhrase( + phraseList === INFORMATIVE_TIPS ? `Tip: ${phrase}` : phrase, + ); }; // Select an initial random phrase