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
+
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
- verified
+ staff
Renders correctly in various states viewing other profi
-
+
+
+
-
-
+
+
+
-
Renders correctly in various states viewing other profi
"height": null,
}
}
- />
-
+
+ >
+
+
+ Full Name
+
+
+
+
+ Edit
+
+
+
+
+
+
+
+
+ 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,
}
}
- />
-
+
+
+
+
+ Primary Language Spoken
+
+
+
+
+ Edit
+
+
+
+
+
+
+
+
+ Everyone on localhost
+
+
+
+
+ Yoruba
+
+
+
+
+
+
+
+ Education
+
+
+
+
+ Edit
+
+
+
+
+
+
+
+
+ Just me
+
+
+
+
+ Elementary/primary school
+
+
+
+
+
+
+
+ Social Links
+
+
+
+
+ Edit
+
+
+
+
+
+
+
+
+ Everyone on localhost
+
+
+
+
+
+
+
+
+
+
+
+
+ About Me
+
+
+
+
+ Edit
+
+
+
+
+
+
+
+
+ Everyone on localhost
+
+
+
+
+ This is my bio
+
+
+
+
+
+
+
+ My Certificates
+
+
+
+
+ Edit
+
+
+
+
+
+
+
+
+ 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`] = `
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ staff
+
+
+
+ Member since
+
+ 2017
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ staff
+
+
+
+ Member since
+
+ 2017
+
+
+
+
+
+
+
+
+
+
+
+ Full Name
+
+
+
+
+ Edit
+
+
+
+
+
+
+
+
+ Just me
+
+
+
+
+ Lemon Seltzer
+
+
+ This is the name that appears in your account and on your certificates.
+
+
+
+
+
+
+
+ Location
+
+
+
+
+ Edit
+
+
+
+
+
+
+
+
+ Everyone on localhost
+
+
+
+
+ Montenegro
+
+
+
+
+
+
+
+ Primary Language Spoken
+
+
+
+
+ Edit
+
+
+
+
+
+
+
+
+ Everyone on localhost
+
+
+
+
+ Yoruba
+
+
+
+
+
+
+
+
+ Social Links
+
+
+
+
+ Edit
+
+
+
+
+
+
+
+
+ Everyone on localhost
+
+
+
+
+
+
+
+
+
+
+
+
+ About Me
+
+
+
+
+ Edit
+
+
+
+
+
+
+
+
+ Everyone on localhost
+
+
+
+
+ This is my bio
+
+
+
+
+
+
+
+ My Certificates
+
+
+
+
+ Edit
+
+
+
+
+
+
+
+
+ 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`] = `
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ staff
+
+
+
+ Member since
+
+ 2017
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ staff
+
+
+
+ Member since
+
+ 2017
+
+
+
+
+
+
+
+
+
+
+
+ Full Name
+
+
+
+
+ Edit
+
+
+
+
+
+
+
+
+ Just me
+
+
+
+
+ Lemon Seltzer
+
+
+ This is the name that appears in your account and on your certificates.
+
+
+
+
+
+
+
+ Location
+
+
+
+
+ Edit
+
+
+
+
+
+
+
+
+ Everyone on localhost
+
+
+
+
+ Montenegro
+
+
+
+
+
+
+
+
+ Education
+
+
+
+
+ Edit
+
+
+
+
+
+
+
+
+ Just me
+
+
+
+
+ Elementary/primary school
+
+
+
+
+
+
+
+ Social Links
+
+
+
+
+ Edit
+
+
+
+
+
+
+
+
+ Everyone on localhost
+
+
+
+
+
+
+
+
+
+
+
+
+ About Me
+
+
+
+
+ Edit
+
+
+
+
+
+
+
+
+ Everyone on localhost
+
+
+
+
+ This is my bio
+
+
+
+
+
+
+
+ My Certificates
+
+
+
+
+ Edit
+
+
+
+
+
+
+
+
+ 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`] = `
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ staff
+
+
+
+ Member since
+
+ 2017
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ staff
+
+
+
+ Member since
+
+ 2017
+
+
+
+
+
+
+
+
+
+
+
+ Full Name
+
+
+
+
+ Edit
+
+
+
+
+
+
+
+
+ Just me
+
+
+
+
+ Lemon Seltzer
+
+
+ This is the name that appears in your account and on your certificates.
+
+
+
+
+
+
+
+ Location
+
+
+
+
+ Edit
+
+
+
+
+
+
+
+
+ Everyone on localhost
+
+
+
+
+ Montenegro
+
+
+
+
+
+
+
+ Primary Language Spoken
+
+
+
+
+ Edit
+
+
+
+
+
+
+
+
+ Everyone on localhost
+
+
+
+
+ Yoruba
+
+
+
+
+ >
+
+
+
+ Education
+
+
+
+
+ Edit
+
+
+
+
+
+
+
+
+ Just me
+
+
+
+
+ Elementary/primary school
+
+
+
+
+
+
+
+ Social Links
+
+
+
+
+ Edit
+
+
+
+
+
+
+
+
+ Everyone on localhost
+
+
+
+
+
+
Renders correctly in various states viewing other profi
"height": null,
}
}
- />
+ >
+
+
+
+ About Me
+
+
+
+
+ Edit
+
+
+
+
+
+
+
+
+ Everyone on localhost
+
+
+
+
+ This is my bio
+
+
+
Renders correctly in various states viewing other profi
"height": null,
}
}
- />
+ >
+
+
+
+ My Certificates
+
+
+
+
+ Edit
+
+
+
+
+
+
+
+
+ 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
-
-
-
-
- Edit
-
-
-
-
+
+
+
-
-
-
-
- Everyone on localhost
-
-
+
+ Who can see this:
+
+
+
+
+
+
+
+
+
+ Just me
+
+
+ Everyone on localhost
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Saving
+
+
+
+
+ Cancel
+
+
+
+
-
- This is my bio
-
Renders correctly in various states viewing own profile
`;
-exports[` Renders correctly in various states while saving an edited bio 1`] = `
+exports[` Renders correctly in various states while saving an edited bio with error 1`] = `
@@ -2137,7 +8916,7 @@ exports[`
Renders correctly in various states while saving an edi
onSubmit={[Function]}
>
Renders correctly in various states while saving an edi
About Me
+
+ bio error
+
+ {error}
+
+ )}
+
+ {error}
+
+ )}
+
+ {error}
+
+ )}
+
+ {error}
+
+ )}
+