diff --git a/src/profile/ProfilePage.test.jsx b/src/profile/ProfilePage.test.jsx index e82ba505d..ba9b19059 100644 --- a/src/profile/ProfilePage.test.jsx +++ b/src/profile/ProfilePage.test.jsx @@ -146,6 +146,93 @@ describe('', () => { expect(tree).toMatchSnapshot(); }); + it('while saving an edited bio with error', () => { + const storeData = JSON.parse(JSON.stringify(storeMocks.savingEditedBio)); + storeData.profilePage.errors.bio = { userMessage: 'bio error' }; + const component = ( + + + + + + + + ); + const tree = renderer.create(component).toJSON(); + expect(tree).toMatchSnapshot(); + }); + + it('test country edit with error', () => { + const storeData = JSON.parse(JSON.stringify(storeMocks.savingEditedBio)); + storeData.profilePage.errors.country = { userMessage: 'country error' }; + storeData.profilePage.currentlyEditingField = 'country'; + const component = ( + + + + + + + + ); + const tree = renderer.create(component).toJSON(); + expect(tree).toMatchSnapshot(); + }); + + it('test education edit with error', () => { + const storeData = JSON.parse(JSON.stringify(storeMocks.savingEditedBio)); + storeData.profilePage.errors.levelOfEducation = { userMessage: 'education error' }; + storeData.profilePage.currentlyEditingField = 'levelOfEducation'; + const component = ( + + + + + + + + ); + const tree = renderer.create(component).toJSON(); + expect(tree).toMatchSnapshot(); + }); + + it('test preferreded language edit with error', () => { + const storeData = JSON.parse(JSON.stringify(storeMocks.savingEditedBio)); + storeData.profilePage.errors.languageProficiencies = { userMessage: 'preferred language error' }; + storeData.profilePage.currentlyEditingField = 'languageProficiencies'; + const component = ( + + + + + + + + ); + const tree = renderer.create(component).toJSON(); + expect(tree).toMatchSnapshot(); + }); + it('without credentials service', () => { const config = getConfig(); config.CREDENTIALS_BASE_URL = ''; diff --git a/src/profile/__snapshots__/ProfilePage.test.jsx.snap b/src/profile/__snapshots__/ProfilePage.test.jsx.snap index 068207cbd..b5682dad8 100644 --- a/src/profile/__snapshots__/ProfilePage.test.jsx.snap +++ b/src/profile/__snapshots__/ProfilePage.test.jsx.snap @@ -31,7 +31,7 @@ exports[` Renders correctly in various states app loading 1`] = ` `; -exports[` Renders correctly in various states viewing other profile 1`] = ` +exports[` Renders correctly in various states test country edit with error 1`] = `
@@ -56,12 +56,35 @@ exports[` Renders correctly in various states viewing other profi
- +
+ +
+
+ profile avatar
Renders correctly in various states viewing other profi

- verified + staff

Renders correctly in various states viewing other profi

-
+ +
+ -
- + + +
-
-
Renders correctly in various states viewing other profi "height": null, } } - /> -
+
+ > +
+

+ Full Name + +

+

+ + + + Just me + +

+
+

+ Lemon Seltzer +

+ + This is the name that appears in your account and on your certificates. + +
+
Renders correctly in various states viewing other profi "height": null, } } - /> -
+
-
+
+ +
+ + +
+ country error +
+
+
+
+ + + + + + + +
+
+ + +
+
+ +
+
+
+
+
+
+

+ 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 education edit with error 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. + +
+
+
+
+
+

+ Location + +

+

+ + + + Everyone on localhost + +

+
+

+ Montenegro +

+
+
+
+
+
+

+ Primary Language Spoken + +

+

+ + + + Everyone on localhost + +

+
+

+ Yoruba +

+
+
+
+
+
+
+
+ + +
+ education error +
+
+
+
+ + + + + + + +
+
+ + +
+
+
+
+
+
+
+
+
+

+ 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 preferreded language edit with error 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. + +
+
+
+
+
+

+ Location + +

+

+ + + + Everyone on localhost + +

+
+

+ Montenegro +

+
+
+
+
+
+
+
+ + +
+ preferred language error +
+
+
+
+ + + + + + + +
+
+ + +
+
+
+
+
+
+
+
+
+

+ 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 1`] = ` +
+
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+ +

+ verified +

+

+ + Member since + + 2017 + + +

+
+ + + + + +
+ + Your profile information is only visible to you. Only your username is visible to others on localhost. + +
+
+
+
+
+
+
+
+
+
+
+ +

+ verified +

+

+ + Member since + + 2017 + + +

+
+ + + + + +
+ + Your profile information is only visible to you. Only your username is visible to others on localhost. + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+`; + +exports[` Renders correctly in various states viewing own profile 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. + +
+
+
+
+
+

+ Location + +

+

+ + + + Everyone on localhost + +

+
+

+ Montenegro +

+
+
+
+
+
+

+ Primary Language Spoken + +

+

+ + + + Everyone on localhost + +

+
+

+ Yoruba +

+
+
+
+ > +
+
+

+ Education + +

+

+ + + + Just me + +

+
+

+ Elementary/primary school +

+
+
+
+
+
+

+ Social Links + +

+

+ + + + Everyone on localhost + +

+
+ +
+
Renders correctly in various states viewing other profi "height": null, } } - /> + > +
+
+

+ About Me + +

+

+ + + + Everyone on localhost + +

+
+

+ This is my bio +

+
+
Renders correctly in various states viewing other profi "height": null, } } - /> + > +
+
+

+ My Certificates + +

+

+ + + + Everyone on localhost + +

+
+
+
+
+
+
+
+

+ Verified Certificate +

+

+ edX Demonstration Course +

+
+

+ + From + +

+

+ edX +

+
+

+ + Completed on + + 3/4/2019 + + +

+ +
+
+
+
+
+
`; -exports[` Renders correctly in various states viewing own profile 1`] = ` +exports[` Renders correctly in various states while saving an edited bio 1`] = `
@@ -1066,78 +7778,145 @@ exports[` Renders correctly in various states viewing own profile } >
-

- About Me - -

-

- +