Skip to content

Commit

Permalink
Merge pull request #757 from DTS-STN/dev
Browse files Browse the repository at this point in the history
merge R88608 - MSCA-Dashboard v1.2.0 to Staging
  • Loading branch information
jhslater authored Nov 25, 2024
2 parents 11a2927 + ba6cd1b commit d0b92ef
Show file tree
Hide file tree
Showing 57 changed files with 835 additions and 1,000 deletions.
17 changes: 15 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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/
Expand All @@ -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' | \
Expand All @@ -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
Expand All @@ -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 && \
Expand All @@ -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 && \
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions __tests__/components/Card.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
4 changes: 4 additions & 0 deletions __tests__/components/Layout.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
4 changes: 4 additions & 0 deletions __tests__/pages/contact-us-pages.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ describe.skip('Dynamic Contact Us Page', () => {
useRouter.mockImplementation(() => ({
pathname: '/',
asPath: '/',
events: {
on: jest.fn(),
off: jest.fn(),
},
}))
})

Expand Down
12 changes: 8 additions & 4 deletions __tests__/pages/decision-reviews.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ describe('Decision Reviews page', () => {
useRouter.mockImplementation(() => ({
pathname: '/',
asPath: '/',
events: {
on: jest.fn(),
off: jest.fn(),
},
}))
})

Expand All @@ -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()
})
Expand All @@ -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()
})
Expand Down
4 changes: 4 additions & 0 deletions __tests__/pages/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ describe('index page', () => {
useRouter.mockImplementation(() => ({
pathname: '/',
asPath: '/',
events: {
on: jest.fn(),
off: jest.fn(),
},
}))
})

Expand Down
4 changes: 4 additions & 0 deletions __tests__/pages/login.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ describe('login page', () => {
useRouter.mockImplementation(() => ({
pathname: '/auth/login',
asPath: '/auth/login',
events: {
on: jest.fn(),
off: jest.fn(),
},
}))
})

Expand Down
4 changes: 4 additions & 0 deletions __tests__/pages/logout.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ describe('logout page', () => {
useRouter.mockImplementation(() => ({
pathname: '/auth/logout',
asPath: '/auth/logout',
events: {
on: jest.fn(),
off: jest.fn(),
},
}))
})

Expand Down
4 changes: 4 additions & 0 deletions __tests__/pages/my-dashboard.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ describe('My Dashboard page', () => {
useRouter.mockImplementation(() => ({
pathname: '/',
asPath: '/',
events: {
on: jest.fn(),
off: jest.fn(),
},
}))
})

Expand Down
4 changes: 4 additions & 0 deletions __tests__/pages/profile.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ describe('My Profile page', () => {
useRouter.mockImplementation(() => ({
pathname: '/',
asPath: '/',
events: {
on: jest.fn(),
off: jest.fn(),
},
}))
})

Expand Down
10 changes: 7 additions & 3 deletions __tests__/pages/security-settings.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ describe('Security Settings page', () => {
useRouter.mockImplementation(() => ({
pathname: '/',
asPath: '/',
events: {
on: jest.fn(),
off: jest.fn(),
},
}))
})

Expand All @@ -63,7 +67,7 @@ describe('Security Settings page', () => {
meta={{}}
breadCrumbItems={content.breadcrumb}
langToggleLink={''}
/>
/>,
)
const SecuritySettingsDiv = screen.getByTestId('securityContent-test')
expect(SecuritySettingsDiv).toBeInTheDocument()
Expand All @@ -79,7 +83,7 @@ describe('Security Settings page', () => {
meta={{}}
breadCrumbItems={content.breadcrumb}
langToggleLink={''}
/>
/>,
)
const SecuritySettingsDiv = screen.getByTestId('securityContent-test')
expect(SecuritySettingsDiv).toBeInTheDocument()
Expand All @@ -95,7 +99,7 @@ describe('Security Settings page', () => {
meta={{}}
breadCrumbItems={content.breadcrumb}
langToggleLink={''}
/>
/>,
)
const securityQuestionsLink = screen.getByTestId('securityQuestionsLink')
expect(securityQuestionsLink).toBeInTheDocument()
Expand Down
6 changes: 3 additions & 3 deletions components/BackToButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ const BackToButton = ({
buttonHref,
buttonId,
buttonLinkText,
refPageAA,
id,
refPageAA = 'mscaPlaceholder',
id = 'mscaPlaceholder',
}: BackToButtonProps) => {
return (
<>
<div>
<Link
href={buttonHref}
id={buttonId}
className="inline-block my-4 py-2.5 px-3.5 font-display text-xl rounded bg-gray-30a text-deep-blue-60b hover:bg-gray-50a hover:cursor-pointer focus:ring focus:ring-offset-4 ring-deep-blue-60f"
className="my-4 inline-block rounded bg-gray-30a px-3.5 py-2.5 font-display text-xl text-deep-blue-60b ring-deep-blue-60f hover:cursor-pointer hover:bg-gray-50a focus:ring focus:ring-offset-4"
data-gc-analytics-customclick={`${refPageAA}:${id}`}
>
{buttonLinkText}
Expand Down
16 changes: 2 additions & 14 deletions components/BenefitTasks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -104,16 +104,4 @@ const BenefitTasks = ({
</div>
)
}

BenefitTasks.defaultProps = {
taskList: [
{
tasks: [
{
icon: 'question-circle', // To ensure a value is used for FontAwesome icons
},
],
},
],
}
export default BenefitTasks
6 changes: 5 additions & 1 deletion components/Breadcrumb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<nav className="py-6" aria-label="Breadcrumb-Fil d’ariane" id={id}>
<ul className="block font-body text-base leading-[23px] text-deep-blue-dark">
Expand Down
23 changes: 7 additions & 16 deletions components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'
Expand Down Expand Up @@ -136,13 +136,4 @@ const Button = ({
</a>
)
}

Button.defaultProps = {
id: 'btn1',
style: 'supertask',
text: 'default',
href: 'no ref',
iconAltText: 'default',
}

export default Button
Loading

0 comments on commit d0b92ef

Please sign in to comment.