11import React from 'react' ;
22import { render , screen , fireEvent } from '@testing-library/react' ;
3- import userEvent from '@testing-library/user-event' ;
43import '@testing-library/jest-dom/extend-expect' ; // needed this to extend the jest-dom assertions (ex toHaveTextContent)
54import { TextEncoder } from 'util' ;
65global . TextEncoder = TextEncoder ;
@@ -9,18 +8,12 @@ import { useStoreContext } from '../store';
98
109// const { Steps } = require('intro.js-react');
1110jest . mock ( '../store' ) ;
11+ const mockedUsedStoreContext = jest . mocked ( useStoreContext ) ;
12+ // useStoreContext as jest.Mock<useStoreContext>.mockImplementaton(() => [state, dispatch])
1213
1314global . URL . createObjectURL = jest . fn ( ( ) => 'https://pdf.com' ) ;
1415global . URL . revokeObjectURL = jest . fn ( ) ;
1516
16- const fileDownload = {
17- href : jest . fn ( ) ,
18- } ;
19-
20- const URL = { revokeObjectURL : jest . fn ( ) } ;
21- // @ts -ignore
22- // jest.spyOn(document, 'createElement').mockImplementation(() => fileDownload);
23-
2417describe ( 'Unit testing for ButtonContainer' , ( ) => {
2518 beforeEach ;
2619
@@ -46,11 +39,12 @@ describe('Unit testing for ButtonContainer', () => {
4639 const importHandler = jest . fn ( ) ;
4740 const fileDownload = jest . fn ( ) ;
4841
49- useStoreContext . mockImplementation ( ( ) => [ state , dispatch ] ) ;
42+ mockedUsedStoreContext . mockImplementation ( ( ) => [ state , dispatch ] ) ;
43+ // useStoreContext.mockImplementation(() => [state, dispatch]);
5044
5145 beforeEach ( ( ) => {
5246 dispatch . mockClear ( ) ;
53- useStoreContext . mockClear ( ) ;
47+ mockedUsedStoreContext . mockClear ( ) ;
5448 currentTab . mode = {
5549 paused : false ,
5650 persist : false ,
0 commit comments