Skip to content

Commit f3f9617

Browse files
committedJul 7, 2023
chore: usePDFExport fix test
1 parent 951b82d commit f3f9617

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
 

‎packages/utils/src/useExportPDF/useExportPDF.test.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ jest.mock('@redhat-cloud-services/frontend-components-notifications/redux', () =
88

99
window.URL.createObjectURL = jest.fn();
1010
global.fetch = jest.fn();
11+
const dispatch = jest.fn();
1112

1213
describe('useExportPDF', () => {
1314
it('Should download PDF', async () => {
1415
global.fetch.mockReturnValueOnce(Promise.resolve({ blob: jest.fn() }));
15-
const exportPDF = useExportPDF('vulnerability');
16+
const exportPDF = useExportPDF('vulnerability', dispatch);
1617
await exportPDF('executiveReport', 'vulnerability-test-export', { someRequestPayload: 'some value' });
1718
expect(fetch).toHaveBeenCalledWith(pdfGeneratorURL, {
1819
body: '{"service":"vulnerability","template":"executiveReport","params":{"someRequestPayload":"some value"}}',
@@ -32,7 +33,7 @@ describe('useExportPDF', () => {
3233
it('Should fail to download PDF with notification', async () => {
3334
global.fetch.mockReturnValueOnce(Promise.reject('error'));
3435

35-
const exportPDF = useExportPDF('vulnerability');
36+
const exportPDF = useExportPDF('vulnerability', dispatch);
3637
await exportPDF('executiveReport', 'vulnerability-test-export', { someRequestPayload: 'some value' });
3738
expect(addNotification).toHaveBeenCalledWith({
3839
description: 'Reinitiate this export to try again.',

0 commit comments

Comments
 (0)
Please sign in to comment.