@@ -91,44 +91,44 @@ describe('AzureAdB2CService', () => {
91
91
expect ( isLogin ) . toEqual ( false ) ;
92
92
} ) ;
93
93
94
- it ( 'setTenantId should save a tenantId in session storage' , ( ) => {
94
+ it ( 'setTenantId should save a tenantId in local storage' , ( ) => {
95
95
spyOn ( UserAgentApplication . prototype , 'getAccount' ) . and . returnValue ( account ) ;
96
- spyOn ( sessionStorage , 'setItem' ) . withArgs ( 'tenant_id' , '12345' ) ;
96
+ spyOn ( localStorage , 'setItem' ) . withArgs ( 'tenant_id' , '12345' ) ;
97
97
98
98
const isLogin = service . isLogin ( ) ;
99
99
service . setTenantId ( ) ;
100
100
101
101
expect ( UserAgentApplication . prototype . getAccount ) . toHaveBeenCalled ( ) ;
102
102
expect ( isLogin ) . toEqual ( true ) ;
103
- expect ( sessionStorage . setItem ) . toHaveBeenCalledWith ( 'tenant_id' , '12345' ) ;
103
+ expect ( localStorage . setItem ) . toHaveBeenCalledWith ( 'tenant_id' , '12345' ) ;
104
104
} ) ;
105
105
106
106
it ( 'setTenantId should not save tenantId if login is false ' , ( ) => {
107
107
spyOn ( UserAgentApplication . prototype , 'getAccount' ) . and . returnValue ( null ) ;
108
- spyOn ( sessionStorage , 'setItem' ) ;
108
+ spyOn ( localStorage , 'setItem' ) ;
109
109
const isLogin = service . isLogin ( ) ;
110
110
expect ( UserAgentApplication . prototype . getAccount ) . toHaveBeenCalled ( ) ;
111
111
expect ( isLogin ) . toEqual ( false ) ;
112
- expect ( sessionStorage . setItem ) . not . toHaveBeenCalled ( ) ;
112
+ expect ( localStorage . setItem ) . not . toHaveBeenCalled ( ) ;
113
113
} ) ;
114
114
115
- it ( 'getTenantId should get the tenantId from session storage' , ( ) => {
115
+ it ( 'getTenantId should get the tenantId from local storage' , ( ) => {
116
116
const tenantId = '12345' ;
117
- spyOn ( sessionStorage , 'getItem' ) . and . returnValue ( tenantId ) ;
117
+ spyOn ( localStorage , 'getItem' ) . and . returnValue ( tenantId ) ;
118
118
119
119
const resp = service . getTenantId ( ) ;
120
120
121
- expect ( sessionStorage . getItem ) . toHaveBeenCalled ( ) ;
121
+ expect ( localStorage . getItem ) . toHaveBeenCalled ( ) ;
122
122
expect ( resp ) . toEqual ( tenantId ) ;
123
123
} ) ;
124
124
125
- it ( 'getBearerToken should get the bearer token from session storage' , ( ) => {
125
+ it ( 'getBearerToken should get the bearer token from local storage' , ( ) => {
126
126
const token = '12345abc' ;
127
- spyOn ( sessionStorage , 'getItem' ) . and . returnValue ( token ) ;
127
+ spyOn ( localStorage , 'getItem' ) . and . returnValue ( token ) ;
128
128
129
129
const resp = service . getBearerToken ( ) ;
130
130
131
- expect ( sessionStorage . getItem ) . toHaveBeenCalled ( ) ;
131
+ expect ( localStorage . getItem ) . toHaveBeenCalled ( ) ;
132
132
expect ( resp ) . toEqual ( token ) ;
133
133
} ) ;
134
134
0 commit comments