This commit is contained in:
Iliyan Angelov
2025-11-28 20:24:58 +02:00
parent b5698b6018
commit cf97df9aeb
135 changed files with 7641 additions and 357 deletions

View File

@@ -0,0 +1,38 @@
import { describe, it, expect, vi, beforeEach } from 'vitest';
import { screen, waitFor } from '../../../test/utils/test-utils';
import { renderWithRouter } from '../../../test/utils/test-utils';
import InvoiceManagementPage from '../InvoiceManagementPage';
describe('Admin InvoiceManagementPage', () => {
beforeEach(() => {
vi.clearAllMocks();
});
it('should render the page', async () => {
renderWithRouter(<InvoiceManagementPage />);
// Wait for loading to finish
await waitFor(() => {
expect(screen.queryByText(/Loading/i)).not.toBeInTheDocument();
}, { timeout: 5000 });
// Check if page content is displayed (use more specific query)
await waitFor(() => {
const pageTitle = screen.queryByRole('heading', { name: /Invoice Management/i });
expect(pageTitle).toBeInTheDocument();
});
});
it('should fetch and display invoices', async () => {
renderWithRouter(<InvoiceManagementPage />);
await waitFor(() => {
// Check if invoices are displayed
const invoicesSection = screen.queryByText(/Invoices/i);
if (invoicesSection) {
expect(invoicesSection).toBeInTheDocument();
}
}, { timeout: 5000 });
});
});