-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create unit test for fragment render component (#1032)
* Unit testing for ArticleCTA component * Unit testing for BasicTextWithImage component * Unit testing for Button component * fixed typos in ImageWithCollapse.stories.js * Unit testing for ImageWithCollapse component * Unit testing for QuoteVerticalLineContent component * Unit testing for ImageVerticalLineContent component * Unit testing for TextContent component * Unit testing for TextWithImage component * updated alt arg value to match unit test query * fix dcterms metadata to better support AA (#1019) * Font Optimization (#1020) * setup google fonts to be served locally * implement fonts using next/font * apply Lato and Notosans variables directly to Modal * remove duplicate main landmark * fix duplicate main landmarks in error pages * added on click test-case for ImageWithCollapse.test * small update to ImageWithCollapse.test * stashing WIP changes for ImageWithCollapse.test.js * updated title path for fragment components * Created storybook entry for FragmentRender component * created unit test for FragmentRender component * add missing ISR_ENABLED ARG to Dockerfile (#1030) * add nullish coalescing operator to error page AA check (#1024) * upgrade nextjs version to fix issue with sharp and output:standalone (#1025) * [Snyk] Upgrade: react, react-dom (#1026) * fix: upgrade multiple dependencies with Snyk Snyk has created this PR to upgrade: - react from 18.2.0 to 18.3.1. See this package in yarn: - react-dom from 18.2.0 to 18.3.1. See this package in yarn: See this project in Snyk: https://app.snyk.io/org/p0nder0sa/project/270b554d-5de8-452f-ad01-8bceb7604a92?utm_source=github&utm_medium=referral&page=upgrade-pr * update yarn.lock --------- Co-authored-by: snyk-bot <[email protected]> Co-authored-by: Jordan <[email protected]> * [Snyk] Upgrade i18next from 23.10.1 to 23.11.3 (#1027) * fix: upgrade i18next from 23.10.1 to 23.11.3 Snyk has created this PR to upgrade i18next from 23.10.1 to 23.11.3. See this package in yarn: i18next See this project in Snyk: https://app.snyk.io/org/p0nder0sa/project/270b554d-5de8-452f-ad01-8bceb7604a92?utm_source=github&utm_medium=referral&page=upgrade-pr * update yarn.lock --------- Co-authored-by: snyk-bot <[email protected]> Co-authored-by: Jordan <[email protected]> * [Snyk] Upgrade @types/react from 18.2.79 to 18.3.1 (#1028) * fix: upgrade @types/react from 18.2.79 to 18.3.1 Snyk has created this PR to upgrade @types/react from 18.2.79 to 18.3.1. See this package in yarn: @types/react See this project in Snyk: https://app.snyk.io/org/p0nder0sa/project/270b554d-5de8-452f-ad01-8bceb7604a92?utm_source=github&utm_medium=referral&page=upgrade-pr * update yarn.lock --------- Co-authored-by: snyk-bot <[email protected]> Co-authored-by: Jordan <[email protected]> * [Snyk] Upgrade joi from 17.13.0 to 17.13.1 (#1029) * fix: upgrade joi from 17.13.0 to 17.13.1 Snyk has created this PR to upgrade joi from 17.13.0 to 17.13.1. See this package in yarn: joi See this project in Snyk: https://app.snyk.io/org/p0nder0sa/project/270b554d-5de8-452f-ad01-8bceb7604a92?utm_source=github&utm_medium=referral&page=upgrade-pr * update yarn.lock --------- Co-authored-by: snyk-bot <[email protected]> Co-authored-by: Jordan <[email protected]> * formatting --------- Co-authored-by: Jordan Willis <[email protected]> Co-authored-by: Jordan <[email protected]> Co-authored-by: Shaun Laughland <[email protected]> Co-authored-by: snyk-bot <[email protected]>
- Loading branch information
1 parent
32ae4dd
commit 373c5dc
Showing
12 changed files
with
1,344 additions
and
9 deletions.
There are no files selected for viewing
1,249 changes: 1,249 additions & 0 deletions
1,249
components/fragment_renderer/FragmentRender.stories.js
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import React from "react"; | ||
import { render, screen } from "@testing-library/react"; | ||
import FragmentRender from "./FragmentRender"; | ||
import { axe, toHaveNoViolations } from "jest-axe"; | ||
import { | ||
ArticleCTA, | ||
TextWithImage, | ||
QuoteVerticalLineContent, | ||
ImageWithCollapse, | ||
Button, | ||
TextContent, | ||
} from "./FragmentRender.stories"; | ||
expect.extend(toHaveNoViolations); | ||
|
||
describe("FragmentRender", () => { | ||
it("renders ArticleCTA component", async () => { | ||
const { container } = render(<FragmentRender {...ArticleCTA.args} />); | ||
expect(screen.getByText((content) => content.startsWith("Information"))) | ||
.toBeInTheDocument; | ||
const results = await axe(container); | ||
expect(results).toHaveNoViolations(); | ||
}); | ||
it("renders TextWithImage component", async () => { | ||
const { container } = render(<FragmentRender {...TextWithImage.args} />); | ||
expect(screen.getByText("It takes time to learn about government benefits")) | ||
.toBeInTheDocument; | ||
expect(screen.getByAltText("Community workers helping people")) | ||
.toBeInTheDocument; | ||
const results = await axe(container); | ||
expect(results).toHaveNoViolations(); | ||
}); | ||
it("renders QuoteVerticalLineContent component", async () => { | ||
const { container } = render( | ||
<FragmentRender {...QuoteVerticalLineContent.args} /> | ||
); | ||
expect( | ||
screen.getByText( | ||
"I didn’t like having to change my birth year to get an estimate" | ||
) | ||
).toBeInTheDocument; | ||
expect(screen.getByText((content) => content.startsWith("We now"))) | ||
.toBeInTheDocument; | ||
const results = await axe(container); | ||
expect(results).toHaveNoViolations(); | ||
}); | ||
it("renders Button component", async () => { | ||
const { container } = render(<FragmentRender {...Button.args} />); | ||
expect(screen.getByText((content) => content.startsWith("Sign in"))) | ||
.toBeInTheDocument; | ||
const results = await axe(container); | ||
expect(results).toHaveNoViolations(); | ||
}); | ||
it("renders TextContent component", async () => { | ||
const { container } = render(<FragmentRender {...TextContent.args} />); | ||
expect(screen.getByText((content) => content.startsWith("Alpha"))) | ||
.toBeInTheDocument; | ||
const results = await axe(container); | ||
expect(results).toHaveNoViolations(); | ||
}); | ||
it("renders ImageWithCollapse component", async () => { | ||
const { container } = render( | ||
<FragmentRender {...ImageWithCollapse.args} /> | ||
); | ||
expect(screen.getByText((content) => content.startsWith("Text version"))) | ||
.toBeInTheDocument; | ||
expect(screen.getByAltText("Benefit news and updates page")) | ||
.toBeInTheDocument; | ||
const results = await axe(container); | ||
expect(results).toHaveNoViolations(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters