import { render, screen } from '@testing-library/react';
import type React from 'react';
import { describe, expect, it, vi } from 'vitest';
import { BreakdownCard } from './breakdown-card';
vi.mock('@/components/ui/amount-display', () => ({
AmountDisplay: ({ amountInCents }: { amountInCents: number }) => (
{amountInCents}
),
}));
vi.mock('@/actions/App/Http/Controllers/TransactionController', () => ({
index: () => ({ url: '/transactions' }),
}));
vi.mock('@inertiajs/react', () => ({
Link: ({ children, href }: { children: React.ReactNode; href: string }) => (
{children}
),
usePage: () => ({ props: { chartColorScheme: 'colorful' } }),
}));
describe('BreakdownCard', () => {
it('renders uncategorized rows when the API returns a null category', () => {
render(
,
);
expect(screen.getByText('Uncategorized')).toBeInTheDocument();
expect(screen.getByText('100%')).toBeInTheDocument();
});
});