nandi/oripublic Fork 0
main
Commits
Clone
git clone https://git.rickub.com/nandi/ori.git
git clone ssh://git@rickub.com/nandi/ori.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

forked from bots-garden/ori

WorkingIndicator.test.tsx · 39 lines · 1.1 KBTypeScript Blame HistoryRaw
✨ Workspace panel, selectors, previews, desktop app, sandbox template, resizable file tree, light/dark theme 76d62ac k33g yesterday1import { act, render, screen } from "@testing-library/react";
2import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
3import {
4 phraseIntervalMs,
5 WorkingIndicator,
6 workingPhrases,
7} from "./WorkingIndicator";
8
9describe("WorkingIndicator", () => {
10 beforeEach(() => {
11 vi.useFakeTimers();
12 });
13
14 afterEach(() => {
15 vi.useRealTimers();
16 });
17
18 it("shows the first working phrase with a spinner", () => {
19 const { container } = render(<WorkingIndicator />);
20 expect(screen.getByText(workingPhrases[0])).toBeDefined();
21 expect(container.querySelector(".spinner")).not.toBeNull();
22 });
23
24 it("rotates to the next phrase after the interval", () => {
25 render(<WorkingIndicator />);
26 act(() => {
27 vi.advanceTimersByTime(phraseIntervalMs);
28 });
29 expect(screen.getByText(workingPhrases[1])).toBeDefined();
30 });
31
32 it("wraps around to the first phrase after the full cycle", () => {
33 render(<WorkingIndicator />);
34 act(() => {
35 vi.advanceTimersByTime(phraseIntervalMs * workingPhrases.length);
36 });
37 expect(screen.getByText(workingPhrases[0])).toBeDefined();
38 });
39});