Backend (Go): - Expanded integration_test.go: health, auth middleware (expired/invalid/wrong-secret JWT), tenant CRUD, case CRUD (create/list/get/update/delete + filters + validation), deadline CRUD (create/list/update/complete/delete), appointment CRUD, dashboard (verifies all sections), deadline calculator (valid/invalid/unknown type), proceeding types & rules, document endpoints, AI extraction (no-key path), and full critical path E2E (auth -> case -> deadline -> appointment -> dashboard -> complete) - New handler unit tests: case (10), appointment (11), dashboard (1), calculate (5), document (10), AI (4) — all testing validation, auth guards, and error paths without DB - Total: ~80 backend tests (unit + integration) Frontend (TypeScript/Vitest): - Installed vitest 2.x, @testing-library/react, @testing-library/jest-dom, jsdom 24, msw - vitest.config.ts with jsdom env, esbuild JSX automatic, path aliases - API client tests (13): URL construction, no double /api/, auth header, tenant header, POST/PUT/PATCH/DELETE methods, error handling, 204 responses - DeadlineTrafficLights tests (5): renders cards, correct counts, zero state, onFilter callback - CaseOverviewGrid tests (4): renders categories, counts, header, zero state - LoginPage tests (8): form rendering, mode toggle, password login, redirect, error display, magic link, registration link - Total: 30 frontend tests Makefile: test-frontend target now runs vitest instead of placeholder echo.
48 lines
1.4 KiB
TypeScript
48 lines
1.4 KiB
TypeScript
import { describe, it, expect } from "vitest";
|
|
import { render, screen } from "@testing-library/react";
|
|
import { CaseOverviewGrid } from "@/components/dashboard/CaseOverviewGrid";
|
|
import type { CaseSummary } from "@/lib/types";
|
|
|
|
describe("CaseOverviewGrid", () => {
|
|
const defaultData: CaseSummary = {
|
|
active_count: 15,
|
|
new_this_month: 4,
|
|
closed_count: 8,
|
|
};
|
|
|
|
it("renders all three case categories", () => {
|
|
render(<CaseOverviewGrid data={defaultData} />);
|
|
|
|
expect(screen.getByText("Aktive Akten")).toBeInTheDocument();
|
|
expect(screen.getByText("Neu (Monat)")).toBeInTheDocument();
|
|
expect(screen.getByText("Abgeschlossen")).toBeInTheDocument();
|
|
});
|
|
|
|
it("displays correct counts", () => {
|
|
render(<CaseOverviewGrid data={defaultData} />);
|
|
|
|
expect(screen.getByText("15")).toBeInTheDocument();
|
|
expect(screen.getByText("4")).toBeInTheDocument();
|
|
expect(screen.getByText("8")).toBeInTheDocument();
|
|
});
|
|
|
|
it("renders the section header", () => {
|
|
render(<CaseOverviewGrid data={defaultData} />);
|
|
|
|
expect(screen.getByText("Aktenübersicht")).toBeInTheDocument();
|
|
});
|
|
|
|
it("handles zero counts", () => {
|
|
const zeroData: CaseSummary = {
|
|
active_count: 0,
|
|
new_this_month: 0,
|
|
closed_count: 0,
|
|
};
|
|
|
|
render(<CaseOverviewGrid data={zeroData} />);
|
|
|
|
const zeros = screen.getAllByText("0");
|
|
expect(zeros).toHaveLength(3);
|
|
});
|
|
});
|