feat(cli): prepend Tip: to informative tips in loading area

This commit is contained in:
Keith Guerin
2026-02-10 00:46:24 -08:00
parent d785498f7c
commit 5708e5f3e2
3 changed files with 14 additions and 5 deletions

View File

@@ -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({

View File

@@ -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 () => {

View File

@@ -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