@@ -8,11 +8,12 @@ jest.mock('@redhat-cloud-services/frontend-components-notifications/redux', () =
8
8
9
9
window . URL . createObjectURL = jest . fn ( ) ;
10
10
global . fetch = jest . fn ( ) ;
11
+ const dispatch = jest . fn ( ) ;
11
12
12
13
describe ( 'useExportPDF' , ( ) => {
13
14
it ( 'Should download PDF' , async ( ) => {
14
15
global . fetch . mockReturnValueOnce ( Promise . resolve ( { blob : jest . fn ( ) } ) ) ;
15
- const exportPDF = useExportPDF ( 'vulnerability' ) ;
16
+ const exportPDF = useExportPDF ( 'vulnerability' , dispatch ) ;
16
17
await exportPDF ( 'executiveReport' , 'vulnerability-test-export' , { someRequestPayload : 'some value' } ) ;
17
18
expect ( fetch ) . toHaveBeenCalledWith ( pdfGeneratorURL , {
18
19
body : '{"service":"vulnerability","template":"executiveReport","params":{"someRequestPayload":"some value"}}' ,
@@ -32,7 +33,7 @@ describe('useExportPDF', () => {
32
33
it ( 'Should fail to download PDF with notification' , async ( ) => {
33
34
global . fetch . mockReturnValueOnce ( Promise . reject ( 'error' ) ) ;
34
35
35
- const exportPDF = useExportPDF ( 'vulnerability' ) ;
36
+ const exportPDF = useExportPDF ( 'vulnerability' , dispatch ) ;
36
37
await exportPDF ( 'executiveReport' , 'vulnerability-test-export' , { someRequestPayload : 'some value' } ) ;
37
38
expect ( addNotification ) . toHaveBeenCalledWith ( {
38
39
description : 'Reinitiate this export to try again.' ,
0 commit comments