tftsr-devops_investigation/tests/unit/dashboard.test.tsx
Shaun Arman 5b8a7d7173
All checks were successful
Test / frontend-tests (pull_request) Successful in 1m4s
Test / frontend-typecheck (pull_request) Successful in 1m6s
Test / rust-fmt-check (pull_request) Successful in 2m26s
Test / rust-clippy (pull_request) Successful in 19m4s
Test / rust-tests (pull_request) Successful in 20m16s
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:53:44 -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");
});
});