Skip to content

Commit ccb0b2b

Browse files
VIA-331 DB SB Move pharmacy booking link from the eligibility fallback to the how to get component.
1 parent fae815a commit ccb0b2b

File tree

5 files changed

+20
-8
lines changed

5 files changed

+20
-8
lines changed

src/app/_components/vaccine/Vaccine.test.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ jest.mock("@src/app/_components/content/MoreInformation", () => ({
3333
jest.mock("@src/app/_components/content/FindOutMore", () => ({
3434
FindOutMoreLink: jest.fn().mockImplementation(() => <div data-testid="find-out-more-link-mock">Find Out More</div>),
3535
}));
36+
jest.mock("@src/app/_components/nbs/PharmacyBookingInfo", () => ({
37+
PharmacyBookingInfo: jest
38+
.fn()
39+
.mockImplementation(() => <div data-testid="pharmacy-booking-link-mock">Pharmacy Booking</div>),
40+
}));
3641
jest.mock("@src/app/_components/content/HowToGetVaccineFallback", () => ({
3742
HowToGetVaccineFallback: jest
3843
.fn()
@@ -242,6 +247,14 @@ describe("Any vaccine page", () => {
242247
expect(getEligibilityForPerson).not.toHaveBeenCalled();
243248
});
244249

250+
it("should contain pharmacy booking link in how to get section", async () => {
251+
await renderNamedVaccinePage(VaccineTypes.RSV_PREGNANCY);
252+
253+
const pharmacyBookingLink = screen.getByTestId("pharmacy-booking-link-mock");
254+
255+
expect(pharmacyBookingLink).toBeVisible();
256+
});
257+
245258
it("should not display the eligibility when there is no content ", async () => {
246259
(getEligibilityForPerson as jest.Mock).mockResolvedValue({
247260
eligibility: {

src/app/_components/vaccine/Vaccine.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { MoreInformation } from "@src/app/_components/content/MoreInformation";
77
import { Eligibility as EligibilityComponent } from "@src/app/_components/eligibility/Eligibility";
88
import { RSVEligibilityFallback } from "@src/app/_components/eligibility/RSVEligibilityFallback";
99
import { NBSBookingAction } from "@src/app/_components/nbs/NBSBookingAction";
10+
import { PharmacyBookingInfo } from "@src/app/_components/nbs/PharmacyBookingInfo";
1011
import Details from "@src/app/_components/nhs-frontend/Details";
1112
import InsetText from "@src/app/_components/nhs-frontend/InsetText";
1213
import NonUrgentCareCard from "@src/app/_components/nhs-frontend/NonUrgentCareCard";
@@ -101,7 +102,10 @@ const Vaccine = async ({ vaccineType }: VaccineProps): Promise<JSX.Element> => {
101102

102103
{/* How-to-get-vaccine section for RSV in pregnancy */}
103104
{vaccineType === VaccineTypes.RSV_PREGNANCY && (
104-
<Details title={HEADINGS.HOW_TO_GET_VACCINE} component={howToGetVaccineFallback} notExpandable={true} />
105+
<>
106+
<Details title={HEADINGS.HOW_TO_GET_VACCINE} component={howToGetVaccineFallback} notExpandable={true} />
107+
<PharmacyBookingInfo vaccineType={vaccineType} />
108+
</>
105109
)}
106110

107111
{/* NBS booking button action for RSV */}

src/services/content-api/parsers/content-styling-service.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ describe("ContentStylingService", () => {
205205
expect(styledVaccineContent.howToGetVaccine.heading).toEqual("How to get this Vaccine");
206206

207207
const expectedRsvSection = "<div><p>para1</p><p>para2</p></div>";
208-
const expectedRsvPregnancySection = `<div><div><p>para3</p><p>para4</p></div><p data-testid="pharmacy-booking-info">In some areas you can also ${mockNBSBookingActionHTML}.</p></div>`;
208+
const expectedRsvPregnancySection = `<div><div><p>para3</p><p>para4</p></div></div>`;
209209
const { container } = render(styledVaccineContent.howToGetVaccine.component);
210210
if (vaccine === VaccineTypes.RSV) {
211211
expect(container).toContainHTML(expectedRsvSection);

src/services/content-api/parsers/custom/both.test.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ describe("styleHowToGetSubsection for rsv in pregnancy", () => {
5959

6060
it("renders HTML if subsection contains rsv in pregnancy", () => {
6161
const { container } = render(<>{styleHowToGetSubsectionForRsvInPregnancy(mockRsvInPregnancySubsection, 0)}</>);
62-
expect(container.innerHTML).toBe(
63-
`<div><div><p>Paragraph 1</p><p>Paragraph 2</p></div><p data-testid=\"pharmacy-booking-info\">In some areas you can also ${mockNBSBookingActionHTML}.</p></div>`,
64-
);
62+
expect(container.innerHTML).toBe(`<div><div><p>Paragraph 1</p><p>Paragraph 2</p></div></div>`);
6563
});
6664
});

src/services/content-api/parsers/custom/rsv-pregnancy.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { PharmacyBookingInfo } from "@src/app/_components/nbs/PharmacyBookingInfo";
2-
import { VaccineTypes } from "@src/models/vaccine";
31
import type { StyledPageSection, VaccinePageSection, VaccinePageSubsection } from "@src/services/content-api/types";
42
import sanitiseHtml from "@src/utils/sanitise-html";
53
import React from "react";
@@ -25,7 +23,6 @@ export const styleHowToGetSubsection = (subsection: VaccinePageSubsection, index
2523
__html: sanitiseHtml(paragraphsMatches.join("")),
2624
}}
2725
/>
28-
<PharmacyBookingInfo vaccineType={VaccineTypes.RSV_PREGNANCY} />
2926
</div>
3027
);
3128
};

0 commit comments

Comments
 (0)