@@ -33,12 +33,12 @@ let mockPathname = {pathname: '/test-path'};
33
33
jest . mock ( 'react-router-dom' , ( ) => ( {
34
34
useLocation : ( ) => mockPathname
35
35
} ) ) ;
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
+ // }));
40
40
41
- const mockUseSharedDataContext = jest . fn ( ) . mockReturnValue ( false ) ;
41
+ const mockUseSharedDataContext = jest . fn ( ) . mockReturnValue ( { stickyFooterState : [ false , ( ) => undefined ] } ) ;
42
42
43
43
jest . mock ( '~/contexts/shared-data' , ( ) => ( {
44
44
__esModule : true ,
@@ -70,7 +70,7 @@ describe('Layouts Default TypeScript Conversions', () => {
70
70
} ) ;
71
71
72
72
describe ( 'shared.tsx utilities' , ( ) => {
73
- test ( 'useSeenCounter hook works with TypeScript types' , ( ) => {
73
+ test ( 'useSeenCounter hook works with TypeScript types' , async ( ) => {
74
74
const TestComponent = ( ) => {
75
75
const [ hasBeenSeenEnough , increment ] = useSeenCounter ( 5 ) ;
76
76
@@ -84,6 +84,15 @@ describe('Layouts Default TypeScript Conversions', () => {
84
84
85
85
render ( < TestComponent /> ) ;
86
86
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 ;
87
96
} ) ;
88
97
89
98
test ( 'usePutAway hook returns proper TypeScript types' , ( ) => {
0 commit comments