Files
hwinkel db953b1e28 Add comprehensive tests for client validation, revenue and expense categories, invoice generation, and schemas
- Implement tests for client validation functions including tax ID, VAT ID, IBAN, BIC, website, and company form validation.
- Create tests for revenue and expense categories ensuring all expected categories and labels are present.
- Add tests for invoice number generation with various scenarios including prefix handling and sequence padding.
- Introduce tests for default categories and their integration, ensuring no overlaps and consistent naming conventions.
- Implement Zod schema validation tests for currency, tax rates, IBAN, tax ID, VAT ID, invoices, companies, and customers.
- Add utility tests for tax calculations, including item amounts and invoice totals, ensuring correct handling of tax rates and formatting.
- Set up Vitest configuration and global test setup for consistent testing environment.
2026-05-08 16:03:05 +02:00

40 lines
1.5 KiB
TypeScript

import { describe, it, expect } from "vitest";
import { render, screen } from "@testing-library/react";
import { InvoiceStatusBadge } from "@/components/invoice/invoice-status-badge";
import { InvoiceStatus } from "@prisma/client";
describe("InvoiceStatusBadge", () => {
it("should render DRAFT status correctly", () => {
render(<InvoiceStatusBadge status={InvoiceStatus.DRAFT} />);
expect(screen.getByText("Entwurf")).toBeInTheDocument();
});
it("should render SENT status correctly", () => {
render(<InvoiceStatusBadge status={InvoiceStatus.SENT} />);
expect(screen.getByText("Versendet")).toBeInTheDocument();
});
it("should render PAID status correctly", () => {
render(<InvoiceStatusBadge status={InvoiceStatus.PAID} />);
expect(screen.getByText("Bezahlt")).toBeInTheDocument();
});
it("should render CANCELLED status correctly", () => {
render(<InvoiceStatusBadge status={InvoiceStatus.CANCELLED} />);
expect(screen.getByText("Storniert")).toBeInTheDocument();
});
it("should render DELETED status correctly", () => {
render(<InvoiceStatusBadge status={InvoiceStatus.DELETED} />);
expect(screen.getByText("Gelöscht")).toBeInTheDocument();
});
it("should have proper badge structure", () => {
render(<InvoiceStatusBadge status={InvoiceStatus.PAID} />);
const badge = screen.getByText("Bezahlt");
expect(badge).toBeInTheDocument();
// Badge should be a div element
expect(badge.tagName).toBe("DIV");
});
});