tftsr-devops_investigation/tests/unit/setup.ts
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

45 lines
1.3 KiB
TypeScript

import { vi, beforeAll, afterAll } from "vitest";
import "@testing-library/jest-dom/vitest";
// Mock Tauri core API
vi.mock("@tauri-apps/api/core", () => ({
invoke: vi.fn(),
}));
// Mock Tauri event API
vi.mock("@tauri-apps/api/event", () => ({
listen: vi.fn(() => Promise.resolve(() => {})),
emit: vi.fn(() => Promise.resolve()),
once: vi.fn(() => Promise.resolve(() => {})),
}));
// Mock Tauri dialog plugin
vi.mock("@tauri-apps/plugin-dialog", () => ({
open: vi.fn(() => Promise.resolve(null)),
save: vi.fn(() => Promise.resolve(null)),
message: vi.fn(() => Promise.resolve()),
ask: vi.fn(() => Promise.resolve(false)),
confirm: vi.fn(() => Promise.resolve(false)),
}));
// Mock Tauri fs plugin
vi.mock("@tauri-apps/plugin-fs", () => ({
readTextFile: vi.fn(() => Promise.resolve("")),
writeTextFile: vi.fn(() => Promise.resolve()),
readFile: vi.fn(() => Promise.resolve(new Uint8Array())),
writeFile: vi.fn(() => Promise.resolve()),
mkdir: vi.fn(() => Promise.resolve()),
exists: vi.fn(() => Promise.resolve(false)),
}));
const originalError = console.error;
beforeAll(() => {
console.error = (...args: unknown[]) => {
if (typeof args[0] === "string" && args[0].includes("Warning:")) return;
originalError(...args);
};
});
afterAll(() => {
console.error = originalError;
});