@@ -67,6 +67,7 @@ describe('BrowserOrejimeService', () => {
6767 authService = jasmine . createSpyObj ( 'authService' , {
6868 isAuthenticated : observableOf ( true ) ,
6969 getAuthenticatedUserFromStore : observableOf ( user ) ,
70+ getAuthenticatedUserIdFromStore : observableOf ( user . id ) ,
7071 } ) ;
7172 configurationDataService = createConfigSuccessSpy ( recaptchaValue ) ;
7273 findByPropertyName = configurationDataService . findByPropertyName ;
@@ -136,6 +137,7 @@ describe('BrowserOrejimeService', () => {
136137
137138 describe ( 'initialize with user' , ( ) => {
138139 beforeEach ( ( ) => {
140+ spyOn ( ( service as any ) , 'getUserId$' ) . and . returnValue ( observableOf ( user . uuid ) ) ;
139141 spyOn ( ( service as any ) , 'getUser$' ) . and . returnValue ( observableOf ( user ) ) ;
140142 translateService . get . and . returnValue ( observableOf ( 'loading...' ) ) ;
141143 spyOn ( service , 'addAppMessages' ) ;
@@ -152,6 +154,7 @@ describe('BrowserOrejimeService', () => {
152154
153155 describe ( 'to not call the initialize user method, but the other methods' , ( ) => {
154156 beforeEach ( ( ) => {
157+ spyOn ( ( service as any ) , 'getUserId$' ) . and . returnValue ( observableOf ( undefined ) ) ;
155158 spyOn ( ( service as any ) , 'getUser$' ) . and . returnValue ( observableOf ( undefined ) ) ;
156159 translateService . get . and . returnValue ( observableOf ( 'loading...' ) ) ;
157160 spyOn ( service , 'addAppMessages' ) ;
@@ -203,22 +206,22 @@ describe('BrowserOrejimeService', () => {
203206 } ) ;
204207 } ) ;
205208
206- describe ( 'getUser $ when there is no one authenticated' , ( ) => {
209+ describe ( 'getUserId $ when there is no one authenticated' , ( ) => {
207210 beforeEach ( ( ) => {
208211 ( service as any ) . authService . isAuthenticated . and . returnValue ( observableOf ( false ) ) ;
209212 } ) ;
210213 it ( 'should return undefined' , ( ) => {
211- getTestScheduler ( ) . expectObservable ( ( service as any ) . getUser $( ) ) . toBe ( '(a|)' , { a : undefined } ) ;
214+ getTestScheduler ( ) . expectObservable ( ( service as any ) . getUserId $( ) ) . toBe ( '(a|)' , { a : undefined } ) ;
212215 } ) ;
213216 } ) ;
214217
215- describe ( 'getUser $ when there someone is authenticated' , ( ) => {
218+ describe ( 'getUserId $ when there someone is authenticated' , ( ) => {
216219 beforeEach ( ( ) => {
217220 ( service as any ) . authService . isAuthenticated . and . returnValue ( observableOf ( true ) ) ;
218- ( service as any ) . authService . getAuthenticatedUserFromStore . and . returnValue ( observableOf ( user ) ) ;
221+ ( service as any ) . authService . getAuthenticatedUserIdFromStore . and . returnValue ( observableOf ( user . id ) ) ;
219222 } ) ;
220- it ( 'should return the user' , ( ) => {
221- getTestScheduler ( ) . expectObservable ( ( service as any ) . getUser $( ) ) . toBe ( '(a|)' , { a : user } ) ;
223+ it ( 'should return the user id ' , ( ) => {
224+ getTestScheduler ( ) . expectObservable ( ( service as any ) . getUserId $( ) ) . toBe ( '(a|)' , { a : user . id } ) ;
222225 } ) ;
223226 } ) ;
224227
@@ -243,7 +246,7 @@ describe('BrowserOrejimeService', () => {
243246
244247 describe ( 'when no user is autheticated' , ( ) => {
245248 beforeEach ( ( ) => {
246- spyOn ( service as any , 'getUser $' ) . and . returnValue ( observableOf ( undefined ) ) ;
249+ spyOn ( service as any , 'getUserId $' ) . and . returnValue ( observableOf ( undefined ) ) ;
247250 } ) ;
248251
249252 it ( 'should return the cookie consents object' , ( ) => {
@@ -256,7 +259,7 @@ describe('BrowserOrejimeService', () => {
256259
257260 describe ( 'when user is autheticated' , ( ) => {
258261 beforeEach ( ( ) => {
259- spyOn ( service as any , 'getUser $' ) . and . returnValue ( observableOf ( user ) ) ;
262+ spyOn ( service as any , 'getUserId $' ) . and . returnValue ( observableOf ( user . uuid ) ) ;
260263 } ) ;
261264
262265 it ( 'should return the cookie consents object' , ( ) => {
@@ -316,7 +319,7 @@ describe('BrowserOrejimeService', () => {
316319 GOOGLE_ANALYTICS_KEY = clone ( ( service as any ) . GOOGLE_ANALYTICS_KEY ) ;
317320 REGISTRATION_VERIFICATION_ENABLED_KEY = clone ( ( service as any ) . REGISTRATION_VERIFICATION_ENABLED_KEY ) ;
318321 MATOMO_ENABLED = clone ( ( service as any ) . MATOMO_ENABLED ) ;
319- spyOn ( ( service as any ) , 'getUser $' ) . and . returnValue ( observableOf ( user ) ) ;
322+ spyOn ( ( service as any ) , 'getUserId $' ) . and . returnValue ( observableOf ( user . uuid ) ) ;
320323 translateService . get . and . returnValue ( observableOf ( 'loading...' ) ) ;
321324 spyOn ( service , 'addAppMessages' ) ;
322325 spyOn ( ( service as any ) , 'initializeUser' ) ;
0 commit comments