mirror of
https://github.com/amitwh/markdown-converter.git
synced 2026-08-03 02:11:07 +05:30
fix(test): use mockRejectedValue for IPC error in ExportPdfDialog test
This commit is contained in:
@@ -35,7 +35,7 @@ describe('ExportPdfDialog', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('renders an error banner when IPC fails', async () => {
|
it('renders an error banner when IPC fails', async () => {
|
||||||
(window.electronAPI.export.pdf as any).mockResolvedValueOnce({ ok: false, error: { code: 'E', message: 'Pandoc not found' } });
|
(window.electronAPI.export.pdf as any).mockRejectedValueOnce(new Error('Pandoc not found'));
|
||||||
render(<ExportPdfDialog sourcePath="/test.md" />);
|
render(<ExportPdfDialog sourcePath="/test.md" />);
|
||||||
await userEvent.click(screen.getByRole('button', { name: /^export$/i }));
|
await userEvent.click(screen.getByRole('button', { name: /^export$/i }));
|
||||||
expect(await screen.findByText(/pandoc not found/i)).toBeInTheDocument();
|
expect(await screen.findByText(/pandoc not found/i)).toBeInTheDocument();
|
||||||
|
|||||||
Reference in New Issue
Block a user