File tree Expand file tree Collapse file tree 2 files changed +54
-0
lines changed
Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Original file line number Diff line number Diff line change 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+ } ) ;
Original file line number Diff line number Diff line change 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+ } ) ;
You can’t perform that action at this time.
0 commit comments