diff --git a/Dockerfile b/Dockerfile index b5801f0e3..070b68fcc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:20.16.0-alpine3.20 AS base +FROM node:20.17.0-alpine3.20 AS base WORKDIR /base COPY package*.json ./ RUN npm ci && npm cache clean --force @@ -11,6 +11,8 @@ ARG HOSTALIAS_CERT ENV HOSTALIAS_CERT=$HOSTALIAS_CERT ARG HOSTALIAS_ROOT_CERT ENV HOSTALIAS_ROOT_CERT=$HOSTALIAS_ROOT_CERT +ARG AUTH_ECAS_CA +ENV AUTH_ECAS_CA=$AUTH_ECAS_CA ARG LOGGING_LEVEL=info ENV LOGGING_LEVEL=$LOGGING_LEVEL ARG AEM_GRAPHQL_ENDPOINT=https://www.canada.ca/graphql/execute.json/decd-endc/ @@ -34,6 +36,11 @@ sed 's/\\n/\n/g' | \ xargs > \ /usr/local/share/ca-certificates/env.crt && \ chmod 644 /usr/local/share/ca-certificates/env.crt && \ +echo ${AUTH_ECAS_CA} | \ +sed 's/\\n/\n/g' | \ +xargs > \ +/usr/local/share/ca-certificates/ecas_env.crt && \ +chmod 644 /usr/local/share/ca-certificates/ecas_env.crt && \ mkdir -p /etc/ssl/certs/ && \ echo ${HOSTALIAS_ROOT_CERT} | \ sed 's/\\n/\n/g' | \ @@ -42,7 +49,7 @@ xargs > \ chmod 644 /etc/ssl/certs/root.crt && \ npm run build -FROM node:20.16.0-alpine3.20 AS production +FROM node:20.17.0-alpine3.20 AS production ENV NODE_ENV=production ARG user=nodeuser @@ -52,6 +59,9 @@ ARG home=/srv/app ARG MSCA_NG_CERT_LOCATION=/usr/local/share/ca-certificates/env.crt ENV MSCA_NG_CERT_LOCATION=$MSCA_NG_CERT_LOCATION +ARG ECAS_CERT_LOCATION=/usr/local/share/ca-certificates/ecas_env.crt +ENV ECAS_CERT_LOCATION=$ECAS_CERT_LOCATION + RUN addgroup \ -S ${group} \ --gid 1001 && \ @@ -67,6 +77,7 @@ WORKDIR ${home} COPY --from=build /etc/ssl/certs/root.crt /etc/ssl/certs/root.crt COPY --from=build --chown=${user}:${group} /usr/local/share/ca-certificates/env.crt ${MSCA_NG_CERT_LOCATION} +COPY --from=build --chown=${user}:${group} /usr/local/share/ca-certificates/ecas_env.crt ${ECAS_CERT_LOCATION} RUN apk update && \ apk add ca-certificates && \ @@ -131,6 +142,8 @@ ENV AUTH_DISABLED=$AUTH_DISABLED ARG AUTH_ECAS_GLOBAL_LOGOUT_URL ENV AUTH_ECAS_GLOBAL_LOGOUT_URL=$AUTH_ECAS_GLOBAL_LOGOUT_URL + +ENV NODE_EXTRA_CA_CERTS=/usr/local/share/ca-certificates/ecas_env.crt # ECAS/next-auth env end ARG PORT=3000 diff --git a/__tests__/components/Card.test.js b/__tests__/components/Card.test.js index 58a922488..a1e654808 100644 --- a/__tests__/components/Card.test.js +++ b/__tests__/components/Card.test.js @@ -33,4 +33,6 @@ describe('Card', () => { const results = await axe(container) expect(results).toHaveNoViolations() }) + + // TODO: Add a test that if an alert is added it actually appears }) diff --git a/__tests__/components/Layout.test.js b/__tests__/components/Layout.test.js index 467dc53a9..816e3029c 100644 --- a/__tests__/components/Layout.test.js +++ b/__tests__/components/Layout.test.js @@ -73,6 +73,10 @@ describe('Layout with default text', () => { useRouter.mockImplementation(() => ({ pathname: '/', asPath: '/', + events: { + on: jest.fn(), + off: jest.fn(), + }, })) it.skip('Layout contains Symbol of GoC', () => { diff --git a/__tests__/pages/contact-us-pages.test.js b/__tests__/pages/contact-us-pages.test.js index 7c8ae61a4..ca7632c4a 100644 --- a/__tests__/pages/contact-us-pages.test.js +++ b/__tests__/pages/contact-us-pages.test.js @@ -57,6 +57,10 @@ describe.skip('Dynamic Contact Us Page', () => { useRouter.mockImplementation(() => ({ pathname: '/', asPath: '/', + events: { + on: jest.fn(), + off: jest.fn(), + }, })) }) diff --git a/__tests__/pages/decision-reviews.test.js b/__tests__/pages/decision-reviews.test.js index 93a311dbf..f15430d65 100644 --- a/__tests__/pages/decision-reviews.test.js +++ b/__tests__/pages/decision-reviews.test.js @@ -81,6 +81,10 @@ describe('Decision Reviews page', () => { useRouter.mockImplementation(() => ({ pathname: '/', asPath: '/', + events: { + on: jest.fn(), + off: jest.fn(), + }, })) }) @@ -94,10 +98,10 @@ describe('Decision Reviews page', () => { meta={{}} breadCrumbItems={content.breadcrumb} langToggleLink={''} - /> + />, ) const DecisionReviewsDiv = screen.getByTestId( - 'decision-reviewsContent-test' + 'decision-reviewsContent-test', ) expect(DecisionReviewsDiv).toBeInTheDocument() }) @@ -112,10 +116,10 @@ describe('Decision Reviews page', () => { meta={{}} breadCrumbItems={content.breadcrumb} langToggleLink={''} - /> + />, ) const DecisionReviewsDiv = screen.getByTestId( - 'decision-reviewsContent-test' + 'decision-reviewsContent-test', ) expect(DecisionReviewsDiv).toBeInTheDocument() }) diff --git a/__tests__/pages/index.test.js b/__tests__/pages/index.test.js index 97da85f80..e1b53bc51 100644 --- a/__tests__/pages/index.test.js +++ b/__tests__/pages/index.test.js @@ -33,6 +33,10 @@ describe('index page', () => { useRouter.mockImplementation(() => ({ pathname: '/', asPath: '/', + events: { + on: jest.fn(), + off: jest.fn(), + }, })) }) diff --git a/__tests__/pages/login.test.js b/__tests__/pages/login.test.js index 14ebc0f64..d14720ae9 100644 --- a/__tests__/pages/login.test.js +++ b/__tests__/pages/login.test.js @@ -39,6 +39,10 @@ describe('login page', () => { useRouter.mockImplementation(() => ({ pathname: '/auth/login', asPath: '/auth/login', + events: { + on: jest.fn(), + off: jest.fn(), + }, })) }) diff --git a/__tests__/pages/logout.test.js b/__tests__/pages/logout.test.js index daf1b28bb..a86a06546 100644 --- a/__tests__/pages/logout.test.js +++ b/__tests__/pages/logout.test.js @@ -43,6 +43,10 @@ describe('logout page', () => { useRouter.mockImplementation(() => ({ pathname: '/auth/logout', asPath: '/auth/logout', + events: { + on: jest.fn(), + off: jest.fn(), + }, })) }) diff --git a/__tests__/pages/my-dashboard.test.js b/__tests__/pages/my-dashboard.test.js index 7cc7cebe8..b696f2a5c 100644 --- a/__tests__/pages/my-dashboard.test.js +++ b/__tests__/pages/my-dashboard.test.js @@ -65,6 +65,10 @@ describe('My Dashboard page', () => { useRouter.mockImplementation(() => ({ pathname: '/', asPath: '/', + events: { + on: jest.fn(), + off: jest.fn(), + }, })) }) diff --git a/__tests__/pages/profile.test.js b/__tests__/pages/profile.test.js index ac92db184..9d8d341b2 100644 --- a/__tests__/pages/profile.test.js +++ b/__tests__/pages/profile.test.js @@ -69,6 +69,10 @@ describe('My Profile page', () => { useRouter.mockImplementation(() => ({ pathname: '/', asPath: '/', + events: { + on: jest.fn(), + off: jest.fn(), + }, })) }) diff --git a/__tests__/pages/security-settings.test.js b/__tests__/pages/security-settings.test.js index 35f92bf94..df1f79d30 100644 --- a/__tests__/pages/security-settings.test.js +++ b/__tests__/pages/security-settings.test.js @@ -50,6 +50,10 @@ describe('Security Settings page', () => { useRouter.mockImplementation(() => ({ pathname: '/', asPath: '/', + events: { + on: jest.fn(), + off: jest.fn(), + }, })) }) @@ -63,7 +67,7 @@ describe('Security Settings page', () => { meta={{}} breadCrumbItems={content.breadcrumb} langToggleLink={''} - /> + />, ) const SecuritySettingsDiv = screen.getByTestId('securityContent-test') expect(SecuritySettingsDiv).toBeInTheDocument() @@ -79,7 +83,7 @@ describe('Security Settings page', () => { meta={{}} breadCrumbItems={content.breadcrumb} langToggleLink={''} - /> + />, ) const SecuritySettingsDiv = screen.getByTestId('securityContent-test') expect(SecuritySettingsDiv).toBeInTheDocument() @@ -95,7 +99,7 @@ describe('Security Settings page', () => { meta={{}} breadCrumbItems={content.breadcrumb} langToggleLink={''} - /> + />, ) const securityQuestionsLink = screen.getByTestId('securityQuestionsLink') expect(securityQuestionsLink).toBeInTheDocument() diff --git a/components/BackToButton.tsx b/components/BackToButton.tsx index 5623789a2..4572a1e80 100644 --- a/components/BackToButton.tsx +++ b/components/BackToButton.tsx @@ -12,8 +12,8 @@ const BackToButton = ({ buttonHref, buttonId, buttonLinkText, - refPageAA, - id, + refPageAA = 'mscaPlaceholder', + id = 'mscaPlaceholder', }: BackToButtonProps) => { return ( <> @@ -21,7 +21,7 @@ const BackToButton = ({ {buttonLinkText} diff --git a/components/BenefitTasks.tsx b/components/BenefitTasks.tsx index 40ff999c4..321e3d6ca 100644 --- a/components/BenefitTasks.tsx +++ b/components/BenefitTasks.tsx @@ -29,8 +29,8 @@ const BenefitTasks = ({ locale, taskList, dataCy, - refPageAA, - acronym, + refPageAA = 'mscaPlaceholder', + acronym = 'mscaPlaceholder', }: BenefitTasksProps) => { const newTabTaskExceptions = [ 'https://www.canada.ca/en/services/benefits/ei/employment-insurance-reporting.html', @@ -104,16 +104,4 @@ const BenefitTasks = ({ ) } - -BenefitTasks.defaultProps = { - taskList: [ - { - tasks: [ - { - icon: 'question-circle', // To ensure a value is used for FontAwesome icons - }, - ], - }, - ], -} export default BenefitTasks diff --git a/components/Breadcrumb.tsx b/components/Breadcrumb.tsx index bf0cc9ed4..d05e81e60 100644 --- a/components/Breadcrumb.tsx +++ b/components/Breadcrumb.tsx @@ -13,7 +13,11 @@ export interface BreadcrumbProps { refPageAA: string } -const Breadcrumb = ({ id, items, refPageAA }: BreadcrumbProps) => { +const Breadcrumb = ({ + id, // TODO: Provide a default value once this is actually mapped in + items, + refPageAA = 'mscaPlaceholder', +}: BreadcrumbProps) => { return ( diff --git a/components/Button.tsx b/components/Button.tsx index d7fb21dcd..ef62835e6 100644 --- a/components/Button.tsx +++ b/components/Button.tsx @@ -6,7 +6,7 @@ interface ButtonProps { style?: 'supertask' | 'primary' | 'secondary' | 'danger' | 'link' | 'none' text: string icon?: string - iconAltText: string + iconAltText?: string iconEnd?: boolean href?: string type?: 'submit' | 'reset' | 'button' @@ -19,20 +19,20 @@ interface ButtonProps { } const Button = ({ - id, - style, - text, + id = 'mscaPlaceholder', + style = 'supertask', + text = 'mscaPlaceholder', icon, - iconAltText, + iconAltText = 'mscaPlaceholder', iconEnd, - href, + href = 'no ref', type, onClick, disabled, className, attributes, children, - refPageAA, + refPageAA = 'mscaPlaceholder', }: ButtonProps) => { const primary = 'text-white bg-blue-primary text-xl hover:bg-deep-blue-focus active:bg-blue-pressed rounded focus:ring focus:ring-offset-4 focus:ring-deep-blue-60f focus:ring-bg-deep-blue-focus' @@ -136,13 +136,4 @@ const Button = ({ ) } - -Button.defaultProps = { - id: 'btn1', - style: 'supertask', - text: 'default', - href: 'no ref', - iconAltText: 'default', -} - export default Button diff --git a/components/Card.tsx b/components/Card.tsx index bd049e68c..883262e2b 100644 --- a/components/Card.tsx +++ b/components/Card.tsx @@ -9,6 +9,8 @@ interface AlertProps { type: string alertHeading: string alertBody: string + alert_icon_alt_text: string + alert_icon_id: string } interface CardProps { cardTitle: string @@ -23,8 +25,16 @@ interface CardProps { } const Card = ({ - cardAlert, - hasAlert, + cardAlert = [ + { + id: '', + type: '', + alertHeading: '', + alertBody: '', + alert_icon_alt_text: '', + alert_icon_id: '', + }, + ], locale, cardTitle, viewMoreLessCaption, @@ -100,27 +110,23 @@ const Card = ({ /> {!isOpen ? null : ( - {hasAlert && - cardAlert?.map((alert, index) => { - const alertType = alert.type[0].split('/').pop() - return ( - - - - ) - })} + {cardAlert.map((alert, index) => { + const alertType = alert.type[0].split('/').pop() + return ( + + + + ) + })} {children} @@ -130,18 +136,4 @@ const Card = ({ ) } -Card.defaultProps = { - cardAlert: [ - { - id: '', - type: '', - alertHeading: '', - alertBody: '', - alert_icon_alt_text: '', - alert_icon_id: '', - }, - ], - hasAlert: true, -} - export default Card diff --git a/components/Collapse.tsx b/components/Collapse.tsx index 986cb7b5e..c6110dde5 100644 --- a/components/Collapse.tsx +++ b/components/Collapse.tsx @@ -8,7 +8,12 @@ interface CollapseProps { dataTestId?: string } -const Collapse = ({ id, title, children, dataTestId }: CollapseProps) => { +const Collapse = ({ + id = 'mscaPlaceholder', + title, + children, + dataTestId, +}: CollapseProps) => { return ( { key={`summary-${id}`} className="cursor-pointer select-none rounded border border-gray-40 px-15px py-5px text-deep-blue-60d outline-none hover:text-blue-hover hover:underline" data-gc-analytics-customclick={`ESDC-EDSC_MSCA-MSDC-SCH:${programs( - id?.split('-')[0], + id.split('-')[0], )}:${title}`} > {title} @@ -35,8 +40,5 @@ const Collapse = ({ id, title, children, dataTestId }: CollapseProps) => { ) } -Collapse.defaultProps = { - id: 'defaultAccordion', -} export default Collapse diff --git a/components/Date.tsx b/components/Date.tsx index a658410f8..8f925fa39 100644 --- a/components/Date.tsx +++ b/components/Date.tsx @@ -4,7 +4,7 @@ interface DateProps { date?: string } -const Date = ({ id, label, date }: DateProps) => { +const Date = ({ id = 'mscaPlaceholder', label, date }: DateProps) => { const dateFormatted = date ? date.split('T')[0] : 'NA' return ( { let biClassName = '' const language = lang === 'en' ? [EN] : lang === 'fr' ? [FR] : [EN, FR] @@ -116,10 +116,4 @@ const ErrorPage = ({ ) } -ErrorPage.defaultProps = { - accountPageLink: '/', - homePageLink: '/', - lang: 'en', -} - export default ErrorPage diff --git a/components/Footer.tsx b/components/Footer.tsx index 10b75c7a3..b9b21a669 100644 --- a/components/Footer.tsx +++ b/components/Footer.tsx @@ -24,12 +24,19 @@ interface FooterProps { } const Footer = ({ - id, - lang, + id = 'mscaPlaceholder', + lang = 'en', btnLink, error, - contactLink, - brandLinks, + contactLink = 'https://www.canada.ca/en/contact.html', + brandLinks = [ + { + href: 'mscaPlaceholderHref', + text: 'mscaPlaceholder', + onClick: () => {}, + id: 'mscaPlaceholder', + }, + ], target, }: FooterProps) => { const t = lang === 'en' ? en : fr @@ -38,13 +45,13 @@ const Footer = ({