test: add auth system and attachment regression coverage

This commit is contained in:
cesnimda
2026-03-22 14:36:52 +01:00
parent 0b3d65e24b
commit 779ba9fc6d
3 changed files with 159 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
import React from 'react';
import '@testing-library/jest-dom';
import { fireEvent, render, screen } from '@testing-library/react';
import { ConfirmProvider } from './confirm';
import { PromptProvider } from './prompt';
import Attachments from './components/Attachments';
import { ToastProvider } from './toast';
import { api } from './api';
jest.mock('./api', () => ({
api: {
get: jest.fn(),
post: jest.fn(),
patch: jest.fn(),
delete: jest.fn(),
},
}));
const mockedApi = api as jest.Mocked<typeof api>;
test('attachments empty state renders drag and drop guidance', async () => {
mockedApi.get.mockResolvedValueOnce({ data: [] } as any);
render(
<ToastProvider>
<ConfirmProvider>
<PromptProvider>
<Attachments jobId={42} />
</PromptProvider>
</ConfirmProvider>
</ToastProvider>,
);
expect(await screen.findByText(/drag and drop files here/i)).toBeInTheDocument();
expect(screen.getByText(/no attachments yet/i)).toBeInTheDocument();
expect(screen.getByText(/max 10 mb each/i)).toBeInTheDocument();
});