@@ -91,44 +91,44 @@ describe('AzureAdB2CService', () => {
9191 expect ( isLogin ) . toEqual ( false ) ;
9292 } ) ;
9393
94- it ( 'setTenantId should save a tenantId in session storage' , ( ) => {
94+ it ( 'setTenantId should save a tenantId in local storage' , ( ) => {
9595 spyOn ( UserAgentApplication . prototype , 'getAccount' ) . and . returnValue ( account ) ;
96- spyOn ( sessionStorage , 'setItem' ) . withArgs ( 'tenant_id' , '12345' ) ;
96+ spyOn ( localStorage , 'setItem' ) . withArgs ( 'tenant_id' , '12345' ) ;
9797
9898 const isLogin = service . isLogin ( ) ;
9999 service . setTenantId ( ) ;
100100
101101 expect ( UserAgentApplication . prototype . getAccount ) . toHaveBeenCalled ( ) ;
102102 expect ( isLogin ) . toEqual ( true ) ;
103- expect ( sessionStorage . setItem ) . toHaveBeenCalledWith ( 'tenant_id' , '12345' ) ;
103+ expect ( localStorage . setItem ) . toHaveBeenCalledWith ( 'tenant_id' , '12345' ) ;
104104 } ) ;
105105
106106 it ( 'setTenantId should not save tenantId if login is false ' , ( ) => {
107107 spyOn ( UserAgentApplication . prototype , 'getAccount' ) . and . returnValue ( null ) ;
108- spyOn ( sessionStorage , 'setItem' ) ;
108+ spyOn ( localStorage , 'setItem' ) ;
109109 const isLogin = service . isLogin ( ) ;
110110 expect ( UserAgentApplication . prototype . getAccount ) . toHaveBeenCalled ( ) ;
111111 expect ( isLogin ) . toEqual ( false ) ;
112- expect ( sessionStorage . setItem ) . not . toHaveBeenCalled ( ) ;
112+ expect ( localStorage . setItem ) . not . toHaveBeenCalled ( ) ;
113113 } ) ;
114114
115- it ( 'getTenantId should get the tenantId from session storage' , ( ) => {
115+ it ( 'getTenantId should get the tenantId from local storage' , ( ) => {
116116 const tenantId = '12345' ;
117- spyOn ( sessionStorage , 'getItem' ) . and . returnValue ( tenantId ) ;
117+ spyOn ( localStorage , 'getItem' ) . and . returnValue ( tenantId ) ;
118118
119119 const resp = service . getTenantId ( ) ;
120120
121- expect ( sessionStorage . getItem ) . toHaveBeenCalled ( ) ;
121+ expect ( localStorage . getItem ) . toHaveBeenCalled ( ) ;
122122 expect ( resp ) . toEqual ( tenantId ) ;
123123 } ) ;
124124
125- it ( 'getBearerToken should get the bearer token from session storage' , ( ) => {
125+ it ( 'getBearerToken should get the bearer token from local storage' , ( ) => {
126126 const token = '12345abc' ;
127- spyOn ( sessionStorage , 'getItem' ) . and . returnValue ( token ) ;
127+ spyOn ( localStorage , 'getItem' ) . and . returnValue ( token ) ;
128128
129129 const resp = service . getBearerToken ( ) ;
130130
131- expect ( sessionStorage . getItem ) . toHaveBeenCalled ( ) ;
131+ expect ( localStorage . getItem ) . toHaveBeenCalled ( ) ;
132132 expect ( resp ) . toEqual ( token ) ;
133133 } ) ;
134134
0 commit comments