updates
This commit is contained in:
@@ -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 });
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user