Skip to content

Commit

Permalink
Revert 'Merge branch 'staging' into main'
Browse files Browse the repository at this point in the history
  • Loading branch information
krischarbonneau committed Jun 11, 2024
1 parent 77b1375 commit 73b1aa4
Show file tree
Hide file tree
Showing 69 changed files with 2,374 additions and 2,072 deletions.
1 change: 0 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ AUTH_ECAS_USERINFO="ECAS userinfo endpoint"
AUTH_PRIVATE={ "kty": "RSA", "n": "example private key" }
AUTH_DISABLED="set to 'true' to disable authentiation"
SWAP_USER_TESTING_LINKS = "Set true to use UT links"
MSCA_NG_CERT_LOCATION="./env.crt"

# OpenTelemetry/Dynatrace settings
# Note: to disable metrics and/or tracing exporting, leave the respective endpoint undefined
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/default-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ jobs:
run: npm run test:coverage -- -u
env:
CI: true
AUTH_DISABLED: true


- name: Store Results
uses: actions/upload-artifact@v3
with:
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ yarn-error.log*
.env
.env.local

#cert
env.crt

# typescript
*.tsbuildinfo
next-env.d.ts
Expand Down
7 changes: 0 additions & 7 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Debug MSCA-D frontend",
"command": "npm run dev",
"request": "launch",
"type": "node-terminal",
"cwd": "${workspaceFolder}"
},
{
"type": "pwa-chrome",
"request": "launch",
Expand Down
16 changes: 3 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:20-alpine3.20 AS base
FROM node:20-alpine3.18 AS base
WORKDIR /base
COPY package*.json ./
RUN npm ci && npm cache clean --force
Expand All @@ -7,8 +7,6 @@ COPY . .
FROM base AS build

# Build envs
ARG HOSTALIAS_CERT
ENV HOSTALIAS_CERT=$HOSTALIAS_CERT
ARG LOGGING_LEVEL=info
ENV LOGGING_LEVEL=$LOGGING_LEVEL
ARG AEM_GRAPHQL_ENDPOINT=https://www.canada.ca/graphql/execute.json/decd-endc/
Expand All @@ -25,19 +23,15 @@ ENV MSCA_ECAS_RASC_BASE_URL=$MSCA_ECAS_RASC_BASE_URL
ENV NODE_ENV=production
WORKDIR /build
COPY --from=base /base ./
RUN npm run build

RUN mkdir -p /usr/local/share/ca-certificates/ && echo ${HOSTALIAS_CERT} | sed 's/\\n/\n/g' | xargs > /usr/local/share/ca-certificates/env.crt && chmod 644 /usr/local/share/ca-certificates/env.crt && npm run build

FROM node:20-alpine3.20 AS production
FROM node:20-alpine3.18 AS production
ENV NODE_ENV=production

ARG user=nodeuser
ARG group=nodegroup
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

RUN addgroup \
-S ${group} \
--gid 1001 && \
Expand All @@ -51,10 +45,6 @@ RUN addgroup \

WORKDIR ${home}

COPY --from=build --chown=${user}:${group} /usr/local/share/ca-certificates/env.crt ${MSCA_NG_CERT_LOCATION}

RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/* && update-ca-certificates

USER ${user}

COPY --from=build --chown=${user}:${group} /build/next.config.js ./
Expand Down
4 changes: 0 additions & 4 deletions __tests__/components/Breadcrumb.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ describe('BreadCrumb', () => {
<Breadcrumb
id="breadcrumbID"
items={[{ text: 'Canada.ca', link: '/' }]}
refPageAA="dashboard"
/>,
)
expect(primary).toBeTruthy()
Expand All @@ -37,7 +36,6 @@ describe('BreadCrumb', () => {
{ text: 'Link2', link: '/' },
{ text: 'Link3', link: '/' },
]}
refPageAA="dashboard"
/>,
)
expect(withItems).toBeTruthy()
Expand All @@ -54,7 +52,6 @@ describe('BreadCrumb', () => {
{ text: 'Max length of breadcrumb 28', link: '/' },
{ text: 'Link3', link: '/' },
]}
refPageAA="dashboard"
/>,
)
expect(withItemsWithLongText).toBeTruthy()
Expand All @@ -65,7 +62,6 @@ describe('BreadCrumb', () => {
<Breadcrumb
id="breadcrumbID"
items={[{ text: 'Canada.ca', link: '/' }]}
refPageAA="dashboard"
/>,
)
const results = await axe(container)
Expand Down
12 changes: 6 additions & 6 deletions __tests__/components/ContextualAlert.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ describe('ContextualAlert', () => {
id="alert_icon_id"
alert_icon_id="icon-id"
alert_icon_alt_text="alt"
type="information"
alertHeading="Information"
alertBody="You may wish to print this page..."
type="info"
message_heading="Information"
message_body="You may wish to print this page..."
/>,
)
it('renders this Contectual Alert component', () => {
Expand All @@ -36,9 +36,9 @@ describe('ContextualAlert', () => {
id="alert_icon_id"
alert_icon_id="icon-id"
alert_icon_alt_text="alt"
type="information"
alertHeading="Information"
alertBody="You may wish to print this page..."
type="info"
message_heading="Information"
message_body="You may wish to print this page..."
/>,
)
const results = await axe(container)
Expand Down
54 changes: 54 additions & 0 deletions __tests__/components/ExitBetaModal.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { render, screen } from '@testing-library/react'
import '@testing-library/jest-dom'
import { axe, toHaveNoViolations } from 'jest-axe'
import ExitBeta from '../../components/ExitBeta'

expect.extend(toHaveNoViolations)

describe('Exit Beta Modal', () => {
it('renders Exit Beta Modal', () => {
render(
<ExitBeta
closeModal={() => {}}
closeModalAria={'close'}
continueLink="/"
popupId={'Test Id'}
popupTitle={'Test Title'}
popupDescription={'Test Description'}
popupPrimaryBtn={{ id: 'Test Primary Id', text: 'Test Primary Text' }}
popupSecondaryBtn={{
id: 'Test Secondary Id',
text: 'Test Secondary Text',
}}
/>,
)
const title = screen.getByText('Test Title')
const description = screen.getByText('Test Description')
const primaryBtnText = screen.getByText('Test Primary Text')
const secondaryBtnText = screen.getByText('Test Secondary Text')
expect(title).toBeInTheDocument()
expect(description).toBeInTheDocument()
expect(primaryBtnText).toBeInTheDocument()
expect(secondaryBtnText).toBeInTheDocument()
})
it('has no a11y viollations', async () => {
const { container } = render(
<ExitBeta
closeModal={() => {}}
closeModalAria={'close'}
continueLink="/"
popupId={'Test Id'}
popupTitle={'Test Title'}
popupDescription={'Test Description'}
popupPrimaryBtn={{ id: 'Test Primary Id', text: 'Test Primary Text' }}
popupSecondaryBtn={{
id: 'Test Secondary Id',
text: 'Test Secondary Text',
}}
/>,
)
const results = await axe(container)
expect(results).toHaveNoViolations()
})
it('placeholder', () => {})
})
1 change: 0 additions & 1 deletion __tests__/components/Header.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ describe('Header', () => {
{ text: 'Max length of breadcrumb 28', link: '/' },
{ text: 'Link3', link: '/' },
],
refPageAA: 'dashboard',
}
test('renders Header component with default props', () => {
render(<Header {...defaultProps} />)
Expand Down
27 changes: 0 additions & 27 deletions __tests__/components/IdleTimeout.test.js

This file was deleted.

40 changes: 0 additions & 40 deletions __tests__/components/InfoMessage.test.js

This file was deleted.

93 changes: 93 additions & 0 deletions __tests__/components/PhaseBanner.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import { render, screen } from '@testing-library/react'
import '@testing-library/jest-dom'
import { axe, toHaveNoViolations } from 'jest-axe'
import PhaseBanner from '../../components/PhaseBanner'

expect.extend(toHaveNoViolations)

describe('PhaseBanner', () => {
const popupContent = {
scId: 'beta-popup-exit',
scHeadingEn: 'Exiting beta version',
scHeadingFr: 'Vous quittez la version bêta',
scContentEn:
'Thank you for trying the beta version. You are now returning to My Service Canada Account home page.',
scContentFr:
"Merci d'avoir essayé la version bêta. Nous vous redirigeons vers la page d’accueil de Mon dossier Service Canada.",
scFragments: [
{
scId: 'stay-on-beta-version',
// scLinkTextAssistiveEn: "Stay on beta version",
// scLinkTextAssistiveFr: "Rester sur la version bêta",
scLinkTextEn: 'Stay on beta version',
scLinkTextFr: 'Rester sur la version bêta',
},
{
scId: 'exit-beta-version',
// scLinkTextAssistiveEn: 'Continue to page',
// scLinkTextAssistiveFr: 'Continuer vers la page',
scLinkTextEn: 'Exit Beta version',
scLinkTextFr: 'Quitter la version beta',
},
],
}
it('renders PhaseBanner', () => {
render(
<PhaseBanner
bannerBoldText={'bannerBoldText'}
bannerText={'bannerText'}
bannerLink={'bannerLink'}
bannerLinkHref={'bannerLinkHref'}
icon={'bell'}
bannerSummaryTitle={'bannerSummaryTitle'}
bannerSummaryContent={'bannerSummaryContent'}
bannerButtonText={'bannerButtonText'}
bannerButtonLink={'bannerButtonLink'}
popupContent={{
popupId: 'popup id',
popupTitle: 'pop up title',
popupDescription: 'pop up desc',
popupPrimaryBtn: { id: 'Test Primary Id', text: 'Test Primary Text' },
popupSecondaryBtn: { id: 'Test secont Id', text: 'Test second Text' },
}}
></PhaseBanner>,
)
const bannerBoldText = screen.getByText('bannerBoldText')
const bannerSummaryTitle = screen.getByText('bannerSummaryTitle')
const bannerText = screen.getByText('bannerText')
const bannerLink = screen.getByText('bannerLink')
const bannerSummaryContent = screen.getByText('bannerSummaryContent')
const bannerButtonText = screen.getByText('bannerButtonText')
expect(bannerBoldText).toBeInTheDocument()
expect(bannerSummaryTitle).toBeInTheDocument()
expect(bannerText).toBeInTheDocument()
expect(bannerLink).toBeInTheDocument()
expect(bannerSummaryContent).toBeInTheDocument()
expect(bannerButtonText).toBeInTheDocument()
})

it('has no a11y viollations', async () => {
const { container } = render(
<PhaseBanner
bannerBoldText={'bannerBoldText'}
bannerText={'bannerText'}
bannerLink={'bannerLink'}
bannerLinkHref={'bannerLinkHref'}
icon={'bell'}
bannerSummaryTitle={'bannerSummaryTitle'}
bannerSummaryContent={'bannerSummaryContent'}
bannerButtonText={'bannerButtonText'}
bannerButtonLink={'bannerButtonLink'}
popupContent={{
popupId: 'popup id',
popupTitle: 'pop up title',
popupDescription: 'pop up desc',
popupPrimaryBtn: { id: 'Test Primary Id', text: 'Test Primary Text' },
popupSecondaryBtn: { id: 'Test secont Id', text: 'Test second Text' },
}}
></PhaseBanner>,
)
const results = await axe(container)
expect(results).toHaveNoViolations()
})
})
Loading

0 comments on commit 73b1aa4

Please sign in to comment.