@@ -13,12 +13,9 @@ describe('Persistence', () => {
1313 store = { } as IStore ;
1414 mockMPInstance = {
1515 _Helpers : {
16- createMainStorageName : ( ) => 'mprtcl-v4_' + 'test-workspace-token' ,
1716 isObject,
1817 } ,
19- _NativeSdkHelpers : {
20- isWebviewEnabled : ( ) => false ,
21- } ,
18+ _NativeSdkHelpers : { } ,
2219 _Store : store ,
2320 Identity : {
2421 getCurrentUser : jest . fn ( ) . mockReturnValue ( {
@@ -33,14 +30,12 @@ describe('Persistence', () => {
3330 } as unknown as IMParticleWebSDKInstance ;
3431
3532 Store . call ( store , { } as SDKInitConfig , mockMPInstance , 'apikey' ) ;
36- store . processConfig ( { workspaceToken : 'test-workspace-token' } as SDKInitConfig ) ;
3733
3834 store . isLocalStorageAvailable = true ;
3935 store . SDKConfig . useCookieStorage = true ;
4036 store . webviewBridgeEnabled = false ;
4137
4238 persistence = new Persistence ( mockMPInstance ) ;
43- window . localStorage . removeItem ( encodeURIComponent ( store . storageName ) ) ;
4439 } ) ;
4540
4641 describe ( '#update' , ( ) => {
@@ -60,7 +55,6 @@ describe('Persistence', () => {
6055
6156 expect ( setCookieSpy ) . not . toHaveBeenCalled ( ) ;
6257 expect ( setLocalStorageSpy ) . not . toHaveBeenCalled ( ) ;
63- expect ( window . localStorage . getItem ( encodeURIComponent ( store . storageName ) ) ) . toBeNull ( ) ;
6458 } ) ;
6559
6660 it ( 'should NOT write to localStorage when useCookieStorage is false' , ( ) => {
@@ -73,7 +67,6 @@ describe('Persistence', () => {
7367
7468 expect ( setCookieSpy ) . not . toHaveBeenCalled ( ) ;
7569 expect ( setLocalStorageSpy ) . not . toHaveBeenCalled ( ) ;
76- expect ( window . localStorage . getItem ( encodeURIComponent ( store . storageName ) ) ) . toBeNull ( ) ;
7770 } ) ;
7871 } ) ;
7972
@@ -95,7 +88,6 @@ describe('Persistence', () => {
9588
9689 expect ( setCookieSpy ) . toHaveBeenCalled ( ) ;
9790 expect ( setLocalStorageSpy ) . toHaveBeenCalled ( ) ;
98- expect ( window . localStorage . getItem ( encodeURIComponent ( store . storageName ) ) ) . toBeNull ( ) ;
9991 } ) ;
10092
10193 it ( 'should write to localStorage when useCookieStorage is false' , ( ) => {
@@ -108,7 +100,6 @@ describe('Persistence', () => {
108100
109101 expect ( setCookieSpy ) . not . toHaveBeenCalled ( ) ;
110102 expect ( setLocalStorageSpy ) . toHaveBeenCalled ( ) ;
111- expect ( window . localStorage . getItem ( encodeURIComponent ( store . storageName ) ) ) . not . toBeNull ( ) ;
112103 } ) ;
113104 } ) ;
114105
@@ -130,7 +121,6 @@ describe('Persistence', () => {
130121
131122 expect ( setCookieSpy ) . toHaveBeenCalled ( ) ;
132123 expect ( setLocalStorageSpy ) . toHaveBeenCalled ( ) ;
133- expect ( window . localStorage . getItem ( encodeURIComponent ( store . storageName ) ) ) . toBeNull ( ) ;
134124 } ) ;
135125
136126 it ( 'should write to localStorage by default when useCookieStorage is false' , ( ) => {
@@ -143,7 +133,6 @@ describe('Persistence', () => {
143133
144134 expect ( setCookieSpy ) . not . toHaveBeenCalled ( ) ;
145135 expect ( setLocalStorageSpy ) . toHaveBeenCalled ( ) ;
146- expect ( window . localStorage . getItem ( encodeURIComponent ( store . storageName ) ) ) . not . toBeNull ( ) ;
147136 } ) ;
148137 } ) ;
149138
@@ -159,7 +148,6 @@ describe('Persistence', () => {
159148
160149 expect ( setCookieSpy ) . not . toHaveBeenCalled ( ) ;
161150 expect ( setLocalStorageSpy ) . not . toHaveBeenCalled ( ) ;
162- expect ( window . localStorage . getItem ( encodeURIComponent ( store . storageName ) ) ) . toBeNull ( ) ;
163151 } ) ;
164152 } ) ;
165153} ) ;
0 commit comments