Skip to content

Commit b92d70c

Browse files
VIA-306 MD: render section about pregnancy on the hub page
1 parent d395493 commit b92d70c

File tree

2 files changed

+34
-8
lines changed

2 files changed

+34
-8
lines changed

src/app/check-and-book-vaccinations/page.test.tsx

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,43 @@ describe("Vaccination Hub Page", () => {
99
render(<VaccinationsHub />);
1010
});
1111

12-
it("renders heading", async () => {
12+
it("renders main heading", async () => {
1313
expectHeadingToBeRendered();
1414
});
1515

16-
it("renders vaccines for all ages button", async () => {
17-
const button = screen.getByRole("link", { name: "View vaccines for all ages" });
18-
expect(button).toBeVisible();
19-
expect(button).toHaveAttribute("href", "/vaccines-for-all-ages");
16+
it("renders subheading about pregnancy", () => {
17+
const subheading: HTMLElement = getHeading("Vaccines if you are pregnant", 2);
18+
expect(subheading).toBeVisible();
19+
});
20+
21+
it("renders subtext about pregnancy", () => {
22+
const subtext: HTMLElement = screen.getByText(
23+
"Some vaccines are recommended during pregnancy to protect the health of you and your baby.",
24+
);
25+
expect(subtext).toBeVisible();
26+
});
27+
28+
it("renders vaccines during pregnancy card link", async () => {
29+
expectLinkToBeRendered("Vaccines during pregnancy", "/vaccines-during-pregnancy");
30+
});
31+
32+
it("renders vaccines for all ages button", async () => {
33+
expectLinkToBeRendered("View vaccines for all ages", "/vaccines-for-all-ages");
2034
});
2135
});
2236

2337
const expectHeadingToBeRendered = () => {
24-
expect(queryHeading(SERVICE_HEADING, 1)).toBeVisible();
38+
expect(getHeading(SERVICE_HEADING, 1)).toBeVisible();
39+
};
40+
41+
const expectLinkToBeRendered = (text: string, href: string) => {
42+
const link: HTMLElement = screen.getByRole("link", { name: text });
43+
expect(link).toBeVisible();
44+
expect(link).toHaveAttribute("href", href);
2545
};
2646

27-
const queryHeading = (text: string, level: number): HTMLElement | null => {
28-
return screen.queryByRole("heading", {
47+
const getHeading = (text: string, level: number): HTMLElement => {
48+
return screen.getByRole("heading", {
2949
name: text,
3050
level: level,
3151
});

src/app/check-and-book-vaccinations/page.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import BackToNHSAppLink from "@src/app/_components/nhs-app/BackToNHSAppLink";
2+
import CardLink from "@src/app/_components/nhs-app/CardLink";
23
import MainContent from "@src/app/_components/nhs-frontend/MainContent";
34
import { NHS_TITLE_SUFFIX, SERVICE_HEADING } from "@src/app/constants";
45
import Link from "next/link";
@@ -11,6 +12,11 @@ const VaccinationsHub = () => {
1112
<BackToNHSAppLink />
1213
<MainContent>
1314
<h1 className={"app-dynamic-page-title__heading"}>{SERVICE_HEADING}</h1>
15+
<h2 className="nhsuk-heading-s">Vaccines if you are pregnant</h2>
16+
<p>Some vaccines are recommended during pregnancy to protect the health of you and your baby.</p>
17+
<ul className="nhsapp-cards nhsapp-cards--stacked" data-testid={"vaccine-cardlinks-adults"}>
18+
<CardLink title={"Vaccines during pregnancy"} link={"/vaccines-during-pregnancy"} />
19+
</ul>
1420
<Link href={"/vaccines-for-all-ages"} className={"nhsuk-button nhsuk-button--secondary"}>
1521
View vaccines for all ages
1622
</Link>

0 commit comments

Comments
 (0)