@@ -33,12 +33,12 @@ let mockPathname = {pathname: '/test-path'};
3333jest . mock ( 'react-router-dom' , ( ) => ( {
3434 useLocation : ( ) => mockPathname
3535} ) ) ;
36- jest . mock ( '~/layouts/default/microsurvey-popup/microsurvey-popup' , ( ) => ( {
37- __esModule : true ,
38- default : ( ) => < > </ >
39- } ) ) ;
36+ // jest.mock('~/layouts/default/microsurvey-popup/microsurvey-popup', () => ({
37+ // __esModule: true,
38+ // default: () => <></>
39+ // }));
4040
41- const mockUseSharedDataContext = jest . fn ( ) . mockReturnValue ( false ) ;
41+ const mockUseSharedDataContext = jest . fn ( ) . mockReturnValue ( { stickyFooterState : [ false , ( ) => undefined ] } ) ;
4242
4343jest . mock ( '~/contexts/shared-data' , ( ) => ( {
4444 __esModule : true ,
@@ -70,7 +70,7 @@ describe('Layouts Default TypeScript Conversions', () => {
7070 } ) ;
7171
7272 describe ( 'shared.tsx utilities' , ( ) => {
73- test ( 'useSeenCounter hook works with TypeScript types' , ( ) => {
73+ test ( 'useSeenCounter hook works with TypeScript types' , async ( ) => {
7474 const TestComponent = ( ) => {
7575 const [ hasBeenSeenEnough , increment ] = useSeenCounter ( 5 ) ;
7676
@@ -84,6 +84,15 @@ describe('Layouts Default TypeScript Conversions', () => {
8484
8585 render ( < TestComponent /> ) ;
8686 expect ( screen . getByTestId ( 'seen-enough' ) ) . toHaveTextContent ( 'false' ) ;
87+ const saveLS = window . localStorage ;
88+ const saveWarn = console . warn ;
89+
90+ console . warn = jest . fn ( ) ;
91+ Reflect . deleteProperty ( window , 'localStorage' ) ;
92+ await user . click ( screen . getByRole ( 'button' ) ) ;
93+ expect ( console . warn ) . toHaveBeenCalledWith ( 'LocalStorage restricted' ) ;
94+ Reflect . defineProperty ( window , 'localStorage' , { value : saveLS } ) ;
95+ console . warn = saveWarn ;
8796 } ) ;
8897
8998 test ( 'usePutAway hook returns proper TypeScript types' , ( ) => {
0 commit comments