Skip to content

Commit a2c51a3

Browse files
VIA-129 MD/DB Add integration test for rendering vaccine pages with vaccine component
1 parent 9982d85 commit a2c51a3

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { render, screen } from "@testing-library/react";
2+
import Vaccine6in1 from "@src/app/vaccines/6-in-1/page";
3+
import { getStyledContentForVaccine } from "@src/services/content-api/contentStylingService";
4+
import { mockStyledContent } from "@test-data/content-api/data";
5+
import { act } from "react";
6+
7+
jest.mock("@src/services/content-api/contentStylingService.tsx");
8+
9+
describe("6-in-1 vaccine page", () => {
10+
beforeEach(() => {
11+
(getStyledContentForVaccine as jest.Mock).mockResolvedValue(
12+
mockStyledContent,
13+
);
14+
});
15+
16+
it("should contain page content from embedded vaccine component", async () => {
17+
await act(async () => {
18+
render(Vaccine6in1());
19+
});
20+
21+
const sixInOneHeading: HTMLElement = screen.getByRole("heading", {
22+
level: 1,
23+
name: `6-in-1 vaccine`,
24+
});
25+
expect(sixInOneHeading).toBeInTheDocument();
26+
});
27+
});
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { render, screen } from "@testing-library/react";
2+
import VaccineRsv from "@src/app/vaccines/rsv/page";
3+
import { getStyledContentForVaccine } from "@src/services/content-api/contentStylingService";
4+
import { mockStyledContent } from "@test-data/content-api/data";
5+
import { act } from "react";
6+
7+
jest.mock("@src/services/content-api/contentStylingService.tsx");
8+
9+
describe("RSV vaccine page", () => {
10+
beforeEach(() => {
11+
(getStyledContentForVaccine as jest.Mock).mockResolvedValue(
12+
mockStyledContent,
13+
);
14+
});
15+
16+
it("should contain page content from embedded vaccine component", async () => {
17+
await act(async () => {
18+
render(VaccineRsv());
19+
});
20+
21+
const rsvHeading: HTMLElement = screen.getByRole("heading", {
22+
level: 1,
23+
name: `RSV vaccine`,
24+
});
25+
expect(rsvHeading).toBeInTheDocument();
26+
});
27+
});

0 commit comments

Comments
 (0)