diff --git a/src/profile-v2/NotFoundPage.test.jsx b/src/profile-v2/NotFoundPage.test.jsx
new file mode 100644
index 0000000..f14021d
--- /dev/null
+++ b/src/profile-v2/NotFoundPage.test.jsx
@@ -0,0 +1,24 @@
+import React from 'react';
+import { render } from '@testing-library/react';
+import { IntlProvider } from '@edx/frontend-platform/i18n';
+import NotFoundPage from './NotFoundPage';
+
+describe('NotFoundPage Snapshot Tests', () => {
+ it('renders correctly', () => {
+ const { asFragment } = render(
+
+
+ ,
+ );
+ expect(asFragment()).toMatchSnapshot();
+ });
+
+ it('renders with custom props', () => {
+ const { asFragment } = render(
+
+
+ ,
+ );
+ expect(asFragment()).toMatchSnapshot();
+ });
+});
diff --git a/src/profile-v2/ProfilePage.test.jsx b/src/profile-v2/ProfilePage.test.jsx
index d186c48..4374110 100644
--- a/src/profile-v2/ProfilePage.test.jsx
+++ b/src/profile-v2/ProfilePage.test.jsx
@@ -256,4 +256,261 @@ describe('', () => {
expect(navigate).toHaveBeenCalledWith('/notfound');
});
});
+
+ describe('form fields', () => {
+ it('renders all form fields for own profile', () => {
+ const contextValue = {
+ authenticatedUser: { userId: 123, username: 'staff', administrator: true },
+ config: getConfig(),
+ };
+ const { getByText } = render(
+ ,
+ );
+
+ expect(getByText('Full name')).toBeInTheDocument();
+ expect(getByText('Country')).toBeInTheDocument();
+ expect(getByText('Bio')).toBeInTheDocument();
+ expect(getByText('Education')).toBeInTheDocument();
+ expect(getByText('Primary language spoken')).toBeInTheDocument();
+ });
+ });
+
+ describe('handles invalid user', () => {
+ it('navigates to not found page for invalid user', () => {
+ const contextValue = {
+ authenticatedUser: { userId: 123, username: 'staff', administrator: true },
+ config: getConfig(),
+ };
+ const navigate = jest.fn();
+ useNavigate.mockReturnValue(navigate);
+ render(
+ ,
+ );
+
+ expect(navigate).toHaveBeenCalledWith('/notfound');
+ });
+ });
+
+ describe('handles empty profile', () => {
+ it('renders empty profile state', () => {
+ const contextValue = {
+ authenticatedUser: { userId: 123, username: 'staff', administrator: true },
+ config: getConfig(),
+ };
+ const component = (
+
+ );
+ const { container: tree } = render(component);
+ expect(tree).toMatchSnapshot();
+ });
+ });
+
+ describe('handles profile with only username', () => {
+ it('renders profile with only username', () => {
+ const contextValue = {
+ authenticatedUser: { userId: 123, username: 'staff', administrator: true },
+ config: getConfig(),
+ };
+ const component = (
+
+ );
+ const { container: tree } = render(component);
+ expect(tree).toMatchSnapshot();
+ });
+ });
+
+ describe('handles profile with no social links', () => {
+ it('renders profile without social links', () => {
+ const contextValue = {
+ authenticatedUser: { userId: 123, username: 'staff', administrator: true },
+ config: getConfig(),
+ };
+ const component = (
+
+ );
+ const { container: tree } = render(component);
+ expect(tree).toMatchSnapshot();
+ });
+ });
+
+ describe('handles profile with only social links', () => {
+ it('renders profile with only social links', () => {
+ const contextValue = {
+ authenticatedUser: { userId: 123, username: 'staff', administrator: true },
+ config: getConfig(),
+ };
+ const component = (
+
+ );
+ const { container: tree } = render(component);
+ expect(tree).toMatchSnapshot();
+ });
+ });
+
+ describe('handles profile with only bio', () => {
+ it('renders profile with only bio', () => {
+ const contextValue = {
+ authenticatedUser: { userId: 123, username: 'staff', administrator: true },
+ config: getConfig(),
+ };
+ const component = (
+
+ );
+ const { container: tree } = render(component);
+ expect(tree).toMatchSnapshot();
+ });
+ });
+
+ describe('handles profile with only country', () => {
+ it('renders profile with only country', () => {
+ const contextValue = {
+ authenticatedUser: { userId: 123, username: 'staff', administrator: true },
+ config: getConfig(),
+ };
+ const component = (
+
+ );
+ const { container: tree } = render(component);
+ expect(tree).toMatchSnapshot();
+ });
+ });
+
+ describe('handles profile with only level of education', () => {
+ it('renders profile with only level of education', () => {
+ const contextValue = {
+ authenticatedUser: { userId: 123, username: 'staff', administrator: true },
+ config: getConfig(),
+ };
+ const component = (
+
+ );
+ const { container: tree } = render(component);
+ expect(tree).toMatchSnapshot();
+ });
+ });
+
+ describe('handles profile with only language proficiencies', () => {
+ it('renders profile with only language proficiencies', () => {
+ const contextValue = {
+ authenticatedUser: { userId: 123, username: 'staff', administrator: true },
+ config: getConfig(),
+ };
+ const component = (
+
+ );
+ const { container: tree } = render(component);
+ expect(tree).toMatchSnapshot();
+ });
+ });
+
+ describe('handles profile with only course certificates', () => {
+ it('renders profile with only course certificates', () => {
+ const contextValue = {
+ authenticatedUser: { userId: 123, username: 'staff', administrator: true },
+ config: getConfig(),
+ };
+ const component = (
+
+ );
+ const { container: tree } = render(component);
+ expect(tree).toMatchSnapshot();
+ });
+ });
+
+ describe('handles profile with only name', () => {
+ it('renders profile with only name', () => {
+ const contextValue = {
+ authenticatedUser: { userId: 123, username: 'staff', administrator: true },
+ config: getConfig(),
+ };
+ const component = (
+
+ );
+ const { container: tree } = render(component);
+ expect(tree).toMatchSnapshot();
+ });
+ });
+
+ describe('handles profile with only username and no other fields', () => {
+ it('renders profile with only username', () => {
+ const contextValue = {
+ authenticatedUser: { userId: 123, username: 'staff', administrator: true },
+ config: getConfig(),
+ };
+ const component = (
+
+ );
+ const { container: tree } = render(component);
+ expect(tree).toMatchSnapshot();
+ });
+ });
+
+ describe('handles profile with no fields and no username', () => {
+ it('renders empty profile state', () => {
+ const contextValue = {
+ authenticatedUser: { userId: 123, username: 'staff', administrator: true },
+ config: getConfig(),
+ };
+ const component = (
+
+ );
+ const { container: tree } = render(component);
+ expect(tree).toMatchSnapshot();
+ });
+ });
});
diff --git a/src/profile-v2/__snapshots__/NotFoundPage.test.jsx.snap b/src/profile-v2/__snapshots__/NotFoundPage.test.jsx.snap
new file mode 100644
index 0000000..60bc1d4
--- /dev/null
+++ b/src/profile-v2/__snapshots__/NotFoundPage.test.jsx.snap
@@ -0,0 +1,29 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`NotFoundPage Snapshot Tests renders correctly 1`] = `
+
+
+
+ The page you're looking for is unavailable or there's an error in the URL. Please check the URL and try again.
+
+
+
+`;
+
+exports[`NotFoundPage Snapshot Tests renders with custom props 1`] = `
+
+
+
+ The page you're looking for is unavailable or there's an error in the URL. Please check the URL and try again.
+
+
+
+`;
diff --git a/src/profile-v2/__snapshots__/ProfilePage.test.jsx.snap b/src/profile-v2/__snapshots__/ProfilePage.test.jsx.snap
index 2280c10..377fb63 100644
--- a/src/profile-v2/__snapshots__/ProfilePage.test.jsx.snap
+++ b/src/profile-v2/__snapshots__/ProfilePage.test.jsx.snap
@@ -2017,3 +2017,1655 @@ exports[` Renders correctly in various states without credentials
`;
+
+exports[` handles empty profile renders empty profile state 1`] = `
+
+
+
+
+
+
+
+
+
+ empty
+
+
+
+ Member since
+
+
+ 2017
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Profile information
+
+
+
+
+
+
+
+
+
+`;
+
+exports[` handles profile with no fields and no username renders empty profile state 1`] = ``;
+
+exports[` handles profile with no social links renders profile without social links 1`] = `
+
+
+
+
+
+
+
+
+
+ noSocialLinks
+
+
+
+ Member since
+
+
+ 2017
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Profile information
+
+
+
+
+
+
+
+
+
+`;
+
+exports[` handles profile with only bio renders profile with only bio 1`] = `
+
+
+
+
+
+
+
+
+
+ onlyBio
+
+
+
+ Member since
+
+
+ 2017
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Profile information
+
+
+
+
+
+
+
+
+
+`;
+
+exports[` handles profile with only country renders profile with only country 1`] = `
+
+
+
+
+
+
+
+
+
+ onlyCountry
+
+
+
+ Member since
+
+
+ 2017
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Profile information
+
+
+
+
+
+
+
+
+
+`;
+
+exports[` handles profile with only course certificates renders profile with only course certificates 1`] = `
+
+
+
+
+
+
+
+
+
+ onlyCourseCertificates
+
+
+
+ Member since
+
+
+ 2017
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Profile information
+
+
+
+
+
+
+
+
+
+`;
+
+exports[` handles profile with only language proficiencies renders profile with only language proficiencies 1`] = `
+
+
+
+
+
+
+
+
+
+ onlyLanguageProficiencies
+
+
+
+ Member since
+
+
+ 2017
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Profile information
+
+
+
+
+
+
+
+
+
+`;
+
+exports[` handles profile with only level of education renders profile with only level of education 1`] = `
+
+
+
+
+
+
+
+
+
+ onlyLevelOfEducation
+
+
+
+ Member since
+
+
+ 2017
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Profile information
+
+
+
+
+
+
+
+
+
+`;
+
+exports[` handles profile with only name renders profile with only name 1`] = `
+
+
+
+
+
+
+
+
+
+ onlyName
+
+
+
+ Member since
+
+
+ 2017
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Profile information
+
+
+
+
+
+
+
+
+
+`;
+
+exports[` handles profile with only social links renders profile with only social links 1`] = `
+
+
+
+
+
+
+
+
+
+ onlySocialLinks
+
+
+
+ Member since
+
+
+ 2017
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Profile information
+
+
+
+
+
+
+
+
+
+`;
+
+exports[` handles profile with only username and no other fields renders profile with only username 1`] = `
+
+
+
+
+
+
+
+
+
+ onlyUsernameNoFields
+
+
+
+ Member since
+
+
+ 2017
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Profile information
+
+
+
+
+
+
+
+
+
+`;
+
+exports[` handles profile with only username renders profile with only username 1`] = `
+
+
+
+
+
+
+
+
+
+ onlyUsername
+
+
+
+ Member since
+
+
+ 2017
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Profile information
+
+
+
+
+
+
+
+
+
+`;