@@ -19,6 +19,7 @@ jest.mock('./services', () => ({
1919 getPreferences : jest . fn ( ) ,
2020 getAccount : jest . fn ( ) ,
2121 getCourseCertificates : jest . fn ( ) ,
22+ getCountryList : jest . fn ( ) ,
2223} ) ) ;
2324
2425jest . mock ( '@edx/frontend-platform/auth' , ( ) => ( {
@@ -68,17 +69,19 @@ describe('RootSaga', () => {
6869 const action = profileActions . fetchProfile ( 'gonzo' ) ;
6970 const gen = handleFetchProfile ( action ) ;
7071
71- const result = [ userAccount , [ 1 , 2 , 3 ] , { preferences : 'stuff' } ] ;
72+ const result = [ userAccount , [ 1 , 2 , 3 ] , [ ] , { preferences : 'stuff' } ] ;
7273
7374 expect ( gen . next ( ) . value ) . toEqual ( select ( userAccountSelector ) ) ;
7475 expect ( gen . next ( selectorData ) . value ) . toEqual ( put ( profileActions . fetchProfileBegin ( ) ) ) ;
7576 expect ( gen . next ( ) . value ) . toEqual ( all ( [
7677 call ( ProfileApiService . getAccount , 'gonzo' ) ,
7778 call ( ProfileApiService . getCourseCertificates , 'gonzo' ) ,
79+ call ( ProfileApiService . getCountryList ) ,
7880 call ( ProfileApiService . getPreferences , 'gonzo' ) ,
81+
7982 ] ) ) ;
8083 expect ( gen . next ( result ) . value )
81- . toEqual ( put ( profileActions . fetchProfileSuccess ( userAccount , result [ 2 ] , result [ 1 ] , true ) ) ) ;
84+ . toEqual ( put ( profileActions . fetchProfileSuccess ( userAccount , result [ 3 ] , result [ 1 ] , true , [ ] ) ) ) ;
8285 expect ( gen . next ( ) . value ) . toEqual ( put ( profileActions . fetchProfileReset ( ) ) ) ;
8386 expect ( gen . next ( ) . value ) . toBeUndefined ( ) ;
8487 } ) ;
@@ -88,6 +91,7 @@ describe('RootSaga', () => {
8891 username : 'gonzo' ,
8992 other : 'data' ,
9093 } ;
94+ const countriesCodesList = [ { code : 'AX' } , { code : 'AL' } ] ;
9195 getAuthenticatedUser . mockReturnValue ( userAccount ) ;
9296 const selectorData = {
9397 userAccount,
@@ -96,16 +100,17 @@ describe('RootSaga', () => {
96100 const action = profileActions . fetchProfile ( 'booyah' ) ;
97101 const gen = handleFetchProfile ( action ) ;
98102
99- const result = [ { } , [ 1 , 2 , 3 ] ] ;
103+ const result = [ { } , [ 1 , 2 , 3 ] , countriesCodesList ] ;
100104
101105 expect ( gen . next ( ) . value ) . toEqual ( select ( userAccountSelector ) ) ;
102106 expect ( gen . next ( selectorData ) . value ) . toEqual ( put ( profileActions . fetchProfileBegin ( ) ) ) ;
103107 expect ( gen . next ( ) . value ) . toEqual ( all ( [
104108 call ( ProfileApiService . getAccount , 'booyah' ) ,
105109 call ( ProfileApiService . getCourseCertificates , 'booyah' ) ,
110+ call ( ProfileApiService . getCountryList ) ,
106111 ] ) ) ;
107112 expect ( gen . next ( result ) . value )
108- . toEqual ( put ( profileActions . fetchProfileSuccess ( result [ 0 ] , { } , result [ 1 ] , false ) ) ) ;
113+ . toEqual ( put ( profileActions . fetchProfileSuccess ( result [ 0 ] , { } , result [ 1 ] , false , countriesCodesList ) ) ) ;
109114 expect ( gen . next ( ) . value ) . toEqual ( put ( profileActions . fetchProfileReset ( ) ) ) ;
110115 expect ( gen . next ( ) . value ) . toBeUndefined ( ) ;
111116 } ) ;
0 commit comments