Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/__tests__/Skeleton.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { render } from '@testing-library/react';
import { describe, it, expect } from 'vitest';
import { Skeleton, InvoiceCardSkeleton } from '@/components/Skeleton';
import { Skeleton, SkeletonCard } from '@/components/Skeleton';

describe('Skeleton', () => {
it('renders with skeleton-shimmer class', () => {
Expand All @@ -25,8 +25,8 @@ describe('Skeleton', () => {
expect(skeletonDiv).toHaveClass('rounded');
});

it('renders InvoiceCardSkeleton with proper ARIA attributes', () => {
const { container } = render(<InvoiceCardSkeleton />);
it('renders SkeletonCard with proper ARIA attributes', () => {
const { container } = render(<SkeletonCard />);
const skeleton = container.querySelector('[role="status"]');
expect(skeleton.getAttribute('aria-busy')).toBe('true');
expect(skeleton.getAttribute('aria-label')).toBe('Loading invoice data');
Expand Down
10 changes: 5 additions & 5 deletions src/__tests__/StatusBadge.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe("StatusBadge", () => {
test("applies correct color class based on status", () => {
render(<StatusBadge status="Released" />);
const badge = screen.getByRole("status");
expect(badge).toHaveClass('bg-green-500/20'), "text-green-400";
expect(badge).toHaveClass('bg-green-500/20', 'text-green-400');
});

test("renders icon when available", () => {
Expand Down Expand Up @@ -86,19 +86,19 @@ describe("StatusBadge", () => {

test("applies correct size classes", () => {
const { rerender } = render(<StatusBadge status="Pending" size="sm" />);
expect(screen.getByRole("status")).toHaveClass('text-xs'), "px-2", "py-0.5";
expect(screen.getByRole("status")).toHaveClass('text-xs', 'px-2', 'py-0.5');

rerender(<StatusBadge status="Pending" size="md" />);
expect(screen.getByRole("status")).toHaveClass('text-sm'), "px-3", "py-1";
expect(screen.getByRole("status")).toHaveClass('text-sm', 'px-3', 'py-1');

rerender(<StatusBadge status="Pending" size="lg" />);
expect(screen.getByRole("status")).toHaveClass('text-base'), "px-4", "py-1.5";
expect(screen.getByRole("status")).toHaveClass('text-base', 'px-4', 'py-1.5');
});

test("badge is focusable with tabIndex", () => {
render(<StatusBadge status="Pending" />);
const badge = screen.getByRole("status");
expect(badge.getAttribute("tabIndex")).toBe("0");
expect(badge.getAttribute("tabindex")).toBe("0");
});

test("all status types render without error", () => {
Expand Down
19 changes: 11 additions & 8 deletions src/lib/invoiceStatus.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import { getMilestones } from "./invoiceMilestones";
import { getDisputesByInvoice } from "./arbitrators";

export const STATUS_CONFIG: Record<string, { color: string; label: string; icon?: string }> = {
Pending: { color: 'blue', label: 'Pending' },
Funded: { color: 'green', label: 'Funded' },
Released: { color: 'green', label: 'Released' },
Refunded: { color: 'red', label: 'Refunded' },
Cancelled: { color: 'gray', label: 'Cancelled' },
Disputed: { color: 'yellow', label: 'Disputed' },
Archived: { color: 'gray', label: 'Archived' },
export const STATUS_CONFIG: Record<string, { color: string; label: string; icon: string; description: string }> = {
Pending: { color: 'blue', label: 'Pending', icon: '⏳', description: 'Awaiting funding from the payer.' },
Active: { color: 'blue', label: 'Active', icon: '🔄', description: 'Invoice is active and awaiting completion.' },
Funded: { color: 'green', label: 'Funded', icon: '💰', description: 'Invoice has been fully funded.' },
Released: { color: 'green', label: 'Released', icon: '✓', description: 'Funds have been released to the recipient.' },
Refunded: { color: 'red', label: 'Refunded', icon: '↩', description: 'Funds have been refunded to the payer.' },
Cancelled: { color: 'gray', label: 'Cancelled', icon: '✕', description: 'Invoice was cancelled.' },
Disputed: { color: 'yellow', label: 'Disputed', icon: '⚠', description: 'Invoice is under dispute.' },
Frozen: { color: 'gray', label: 'Frozen', icon: '🧊', description: 'Invoice is frozen pending resolution.' },
Archived: { color: 'gray', label: 'Archived', icon: '📦', description: 'Invoice has been archived.' },
Expired: { color: 'red', label: 'Expired', icon: '⏰', description: 'Invoice deadline has passed.' },
};

export type InvoiceStatus =
Expand Down