tftsr-devops_investigation/tests/unit/dashboard.test.tsx
Shaun Arman f9588a3bfe chore: Add GitHub Actions workflows
- test.yml: Rust fmt/clippy/tests, frontend typecheck/tests
- build-images.yml: CI Docker image builds
- release.yml: Auto-tag, wiki sync, multi-platform release builds

Fixes: -testing-library/react screen import for v16 compatibility
2026-04-08 21:51:01 -05:00

48 lines
1.3 KiB
TypeScript

import { describe, it, expect, beforeEach, vi } from "vitest";
import { render } from "@testing-library/react";
import { screen } from "@testing-library/react";
import { MemoryRouter } from "react-router-dom";
import Dashboard from "@/pages/Dashboard";
import { useHistoryStore } from "@/stores/historyStore";
vi.mock("@/stores/historyStore");
describe("Dashboard Page", () => {
beforeEach(() => {
vi.mocked(useHistoryStore).mockReturnValue({
issues: [],
isLoading: false,
error: null,
searchQuery: "",
loadIssues: vi.fn(),
searchIssues: vi.fn(),
setSearchQuery: vi.fn(),
});
});
it("refresh button is visible with proper contrast", () => {
render(
<MemoryRouter>
<Dashboard />
</MemoryRouter>
);
const refreshButton = screen.getByRole("button", { name: /refresh/i });
expect(refreshButton).toBeInTheDocument();
// Button should have outline variant for visibility
expect(refreshButton.className).toContain("outline");
});
it("refresh button shows icon and text", () => {
render(
<MemoryRouter>
<Dashboard />
</MemoryRouter>
);
const refreshButton = screen.getByRole("button", { name: /refresh/i });
expect(refreshButton.textContent).toContain("Refresh");
});
});