Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding small test to profile.test.js #345

Merged
merged 3 commits into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 40 additions & 1 deletion __tests__/pages/profile.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jest.mock('next/router', () => ({

// mocks profile mapper
jest.mock('../../graphql/mappers/profile', () => ({
getMyDashboardContent: () => {
getProfileContent: () => {
return new Promise(function (resolve, reject) {
resolve({ en: {}, fr: {} })
})
Expand Down Expand Up @@ -113,4 +113,43 @@ describe('My Profile page', () => {
const profileDiv = screen.getByTestId('profileContent-test')
expect(profileDiv).toBeInTheDocument()
})

it('Test getServerSideProps', async () => {
const props = await getServerSideProps({ locale: 'en' })

expect(props).toEqual({
props: {
content: {},
bannerContent: {},
breadCrumbItems: undefined,
langToggleLink: '/fr/profil',
locale: 'en',
meta: {
data_en: {
title: 'Profile - My Service Canada Account',
desc: 'English',
author: 'Service Canada',
keywords: '',
service: 'ESDC-EDSC_MSCA-MSDC',
creator: 'Employment and Social Development Canada',
accessRights: '1',
},
data_fr: {
title: 'Profil - Mon dossier Service Canada',
desc: 'Français',
author: 'Service Canada',
keywords: '',
service: 'ESDC-EDSC_MSCA-MSDC',
creator: 'Emploi et Développement social Canada',
accessRights: '1',
},
},
popupContent: {},
popupContentNA: {},
popupYouHaveBeenSignedout: {},
popupStaySignedIn: {},
aaPrefix: 'ESDC-EDSC:undefined',
},
})
})
})
2 changes: 1 addition & 1 deletion __tests__/pages/security-settings.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jest.mock('../../graphql/mappers/auth-modals', () => ({
},
}))

describe('Privacy Notice Terms Conditions page', () => {
describe('Security Settings page', () => {
const content = {
id: 'security-settings',
breadcrumb: [
Expand Down
1 change: 0 additions & 1 deletion components/PageLink.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import Link from 'next/link'
import BackToButton from './BackToButton'

export default function PageLink(props) {
const linkText = undefined
krischarbonneau marked this conversation as resolved.
Show resolved Hide resolved
let linkID = props.linkText?.replace(/\s+/g, '')

return (
Expand Down
Loading