tftsr-devops_investigation/tests/unit/dashboard.test.tsx
Shaun Arman 4c4ca40146 fix: UI contrast issues and ARM64 build failure
**UI Fixes (TDD approach - tests first, then implementation):**
- Resolution steps: improved text contrast (text-foreground vs muted)
- DocEditor preview: added text-foreground class for readability
- History page: fixed domain display (category field) with better contrast
- Audit Log: added expandable rows with View/Hide buttons to show transmitted data
- Dashboard & buttons: already had proper contrast with outline variant
- Export document: fixed missing title/content parameters in command signature

**Tests Added (13 new tests, all passing):**
- tests/unit/resolution.test.tsx - resolution steps contrast
- tests/unit/docEditor.test.tsx - preview mode and export buttons
- tests/unit/exportDocument.test.ts - export parameters validation
- tests/unit/history.test.tsx - domain display and filtering
- tests/unit/dashboard.test.tsx - refresh button visibility
- tests/unit/auditLog.test.tsx - data visibility and expandable rows
- tests/unit/setup.ts - added @testing-library/jest-dom matchers

**CI Fix:**
- Removed platform label from ARM64 build step (native agent, old Docker)

**Test Results:**
- Frontend: 38/38 passing 
- Backend: 64/64 passing 
- TypeScript: no errors 

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-04-03 08:05:58 -05:00

47 lines
1.2 KiB
TypeScript

import { describe, it, expect, beforeEach, vi } from "vitest";
import { render, 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");
});
});