**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>
49 lines
1.3 KiB
TypeScript
49 lines
1.3 KiB
TypeScript
import { describe, it, expect, beforeEach, vi } from "vitest";
|
|
import { invoke } from "@tauri-apps/api/core";
|
|
import { exportDocumentCmd } from "@/lib/tauriCommands";
|
|
|
|
vi.mock("@tauri-apps/api/core");
|
|
|
|
describe("exportDocumentCmd", () => {
|
|
beforeEach(() => {
|
|
vi.clearAllMocks();
|
|
});
|
|
|
|
it("includes title parameter when calling backend", async () => {
|
|
const mockInvoke = vi.mocked(invoke);
|
|
mockInvoke.mockResolvedValue("/path/to/doc.pdf");
|
|
|
|
const docId = "doc-123";
|
|
const title = "Test Document";
|
|
const contentMd = "# Test Content";
|
|
const format = "pdf";
|
|
const outputDir = ".";
|
|
|
|
await exportDocumentCmd(docId, title, contentMd, format, outputDir);
|
|
|
|
// Check that invoke was called with the correct parameters
|
|
expect(mockInvoke).toHaveBeenCalledWith(
|
|
"export_document",
|
|
expect.objectContaining({
|
|
title,
|
|
contentMd,
|
|
format,
|
|
outputDir,
|
|
})
|
|
);
|
|
});
|
|
|
|
it("handles missing title gracefully", async () => {
|
|
const mockInvoke = vi.mocked(invoke);
|
|
mockInvoke.mockRejectedValue("missing required key title");
|
|
|
|
const docId = "doc-123";
|
|
const title = "";
|
|
const contentMd = "# Test";
|
|
const format = "pdf";
|
|
const outputDir = ".";
|
|
|
|
await expect(exportDocumentCmd(docId, title, contentMd, format, outputDir)).rejects.toMatch(/title/i);
|
|
});
|
|
});
|