diff --git a/src/profile/ProfilePage.test.jsx b/src/profile/ProfilePage.test.jsx index 997a92e86..ae1152a4a 100644 --- a/src/profile/ProfilePage.test.jsx +++ b/src/profile/ProfilePage.test.jsx @@ -285,6 +285,45 @@ describe('', () => { expect(container.querySelector('.alert-danger')).toHaveClass('show'); }); + + it('test user with non disabled country', () => { + const storeData = JSON.parse(JSON.stringify(storeMocks.savingEditedBio)); + storeData.profilePage.errors.country = {}; + storeData.profilePage.currentlyEditingField = 'country'; + storeData.profilePage.disabledCountries = ['RU']; + const contextValue = { + authenticatedUser: { userId: 123, username: 'staff', administrator: true }, + config: getConfig(), + }; + const component = ( + + ); + const { container: tree } = render(component); + expect(tree).toMatchSnapshot(); + }); + + it('test user with disabled country', () => { + const storeData = JSON.parse(JSON.stringify(storeMocks.savingEditedBio)); + storeData.profilePage.errors.country = {}; + storeData.profilePage.currentlyEditingField = 'country'; + storeData.profilePage.disabledCountries = ['RU']; + storeData.profilePage.account.country = 'RU'; + const contextValue = { + authenticatedUser: { userId: 123, username: 'staff', administrator: true }, + config: getConfig(), + }; + const component = ( + + ); + const { container: tree } = render(component); + expect(tree).toMatchSnapshot(); + }); }); describe('handles analytics', () => { diff --git a/src/profile/__mocks__/savingEditedBio.mockStore.js b/src/profile/__mocks__/savingEditedBio.mockStore.js index 63551e823..a104762d6 100644 --- a/src/profile/__mocks__/savingEditedBio.mockStore.js +++ b/src/profile/__mocks__/savingEditedBio.mockStore.js @@ -125,7 +125,8 @@ module.exports = { } ], drafts: {}, - isLoadingProfile: false + isLoadingProfile: false, + disabledCountries: [], }, router: { location: { diff --git a/src/profile/__snapshots__/ProfilePage.test.jsx.snap b/src/profile/__snapshots__/ProfilePage.test.jsx.snap index bb9c11d0d..5e26ad9dc 100644 --- a/src/profile/__snapshots__/ProfilePage.test.jsx.snap +++ b/src/profile/__snapshots__/ProfilePage.test.jsx.snap @@ -5107,6 +5107,4236 @@ exports[` Renders correctly in various states test preferreded la `; +exports[` Renders correctly in various states test user with disabled country 1`] = ` +
+
+
+
+
+
+
+
+
+
+ +
+ profile avatar +
+
+ +
+
+
+
+
+
+ +

+ staff +

+

+ Member since + 2017 +

+
+
+
+
+
+
+
+
+
+ +

+ staff +

+

+ Member since + 2017 +

+
+
+
+
+
+
+
+

+ Full Name + +

+

+ + + + Just me + +

+
+

+ Lemon Seltzer +

+ + This is the name that appears in your account and on your certificates. + +
+
+
+
+
+
+
+ + +
+
+
+ + + + + + + +
+
+ + +
+
+
+
+
+
+
+
+
+

+ Primary Language Spoken + +

+

+ + + + Everyone on localhost + +

+
+

+ Yoruba +

+
+
+
+
+
+

+ Education + +

+

+ + + + Just me + +

+
+

+ Elementary/primary school +

+
+
+
+
+
+

+ Social Links + +

+

+ + + + Everyone on localhost + +

+
+ +
+
+
+
+
+
+
+

+ About Me + +

+

+ + + + Everyone on localhost + +

+
+

+ This is my bio +

+
+
+
+
+
+

+ My Certificates + +

+

+ + + + Everyone on localhost + +

+
+
+
+
+
+
+
+

+ Verified Certificate +

+

+ edX Demonstration Course +

+
+

+ From +

+

+ edX +

+
+

+ Completed on + 3/4/2019 +

+ +
+
+
+
+
+
+
+
+
+
+
+`; + +exports[` Renders correctly in various states test user with non disabled country 1`] = ` +
+
+
+
+
+
+
+
+
+
+ +
+ profile avatar +
+
+ +
+
+
+
+
+
+ +

+ staff +

+

+ Member since + 2017 +

+
+
+
+
+
+
+
+
+
+ +

+ staff +

+

+ Member since + 2017 +

+
+
+
+
+
+
+
+

+ Full Name + +

+

+ + + + Just me + +

+
+

+ Lemon Seltzer +

+ + This is the name that appears in your account and on your certificates. + +
+
+
+
+
+
+
+ + +
+
+
+ + + + + + + +
+
+ + +
+
+
+
+
+
+
+
+
+

+ Primary Language Spoken + +

+

+ + + + Everyone on localhost + +

+
+

+ Yoruba +

+
+
+
+
+
+

+ Education + +

+

+ + + + Just me + +

+
+

+ Elementary/primary school +

+
+
+
+
+
+

+ Social Links + +

+

+ + + + Everyone on localhost + +

+
+ +
+
+
+
+
+
+
+

+ About Me + +

+

+ + + + Everyone on localhost + +

+
+

+ This is my bio +

+
+
+
+
+
+

+ My Certificates + +

+

+ + + + Everyone on localhost + +

+
+
+
+
+
+
+
+

+ Verified Certificate +

+

+ edX Demonstration Course +

+
+

+ From +

+

+ edX +

+
+

+ Completed on + 3/4/2019 +

+ +
+
+
+
+
+
+
+
+
+
+
+`; + exports[` Renders correctly in various states viewing other profile with all fields 1`] = `