Skip to content

Commit bf707bd

Browse files
VIA-293 SB/EO Add Flu for children aged 2 to 3 page
1 parent 47e9ca8 commit bf707bd

File tree

8 files changed

+722
-1
lines changed

8 files changed

+722
-1
lines changed

e2e/constants.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ type VaccinePageName =
1616
| "hib-menc"
1717
| "flu-in-pregnancy"
1818
| "flu-vaccine"
19-
| "covid-19-vaccine";
19+
| "covid-19-vaccine"
20+
| "flu-for-children";
2021
type FailurePageName = "sso-failure" | "service-failure" | "not-found";
2122
type SessionPageName = "session-timeout" | "session-logout";
2223
type IndexPageName = "vaccines-for-all-ages" | "vaccine-hub" | "vaccines-during-pregnancy";
@@ -156,6 +157,12 @@ export const AppPageDetails: Record<PageName, PageDetails> = {
156157
title: `COVID-19 vaccine - ${SERVICE_HEADING} - ${NHS_TITLE_SUFFIX}`,
157158
snapshotFilename: "default-covid-19-vaccine.png",
158159
},
160+
"flu-for-children": {
161+
url: "/vaccines/flu-vaccine-for-children",
162+
heading: "Flu vaccine for children aged 2 to 3",
163+
title: `Flu vaccine for children aged 2 to 3 - ${SERVICE_HEADING} - ${NHS_TITLE_SUFFIX}`,
164+
snapshotFilename: "default-flu-vaccine-for-children.png",
165+
},
159166

160167
// failure pages
161168
"sso-failure": {

e2e/general/navigation.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ test.describe("Navigation", () => {
4848
{ section: AgeSectionTestId.CHILDREN, linkText: "MenB", pageName: "menb-children" },
4949
{ section: AgeSectionTestId.CHILDREN, linkText: "Pneumococcal", pageName: "pneumococcal" },
5050
{ section: AgeSectionTestId.CHILDREN, linkText: "Hib/MenC", pageName: "hib-menc" },
51+
{ section: AgeSectionTestId.CHILDREN, linkText: "Flu for children aged 2 to 3", pageName: "flu-for-children" },
5152

5253
{ section: AgeSectionTestId.BABIES, linkText: "6-in-1", pageName: "6-in-1" },
5354
{ section: AgeSectionTestId.BABIES, linkText: "Rotavirus", pageName: "rotavirus" },

src/models/vaccine.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ enum VaccineType {
2222
FLU_IN_PREGNANCY = "FLU_IN_PREGNANCY",
2323
COVID_19 = "COVID_19",
2424
FLU_FOR_ADULTS = "FLU_FOR_ADULTS",
25+
FLU_FOR_CHILDREN = "FLU_FOR_CHILDREN",
2526
}
2627

2728
export type VaccineDetails = {
@@ -336,6 +337,22 @@ const VaccineInfo: Record<VaccineType, VaccineDetails> = {
336337
cacheFilename: "flu-vaccine.json" as Filename,
337338
nbsPath: "path-to-be-removed" as UrlPathFragment,
338339
},
340+
[VaccineType.FLU_FOR_CHILDREN]: {
341+
urlPath: "flu-vaccine-for-children" as UrlPathFragment,
342+
displayName: {
343+
titleCase: "Flu",
344+
midSentenceCase: "flu",
345+
indefiniteArticle: "a",
346+
},
347+
heading: "Flu vaccine for children aged 2 to 3",
348+
cardLinkTitle: "Flu for children aged 2 to 3",
349+
nhsWebpageLink: new URL("https://www.nhs.uk/vaccinations/child-flu-vaccine/"),
350+
nhsHowToGetWebpageLink: new URL("https://www.nhs.uk/vaccinations/child-flu-vaccine/#how-to-get-it"),
351+
personalisedEligibilityStatusRequired: false,
352+
contentPath: "vaccinations/flu-vaccine-for-children" as UrlPathFragment,
353+
cacheFilename: "child-flu-vaccine.json" as Filename,
354+
nbsPath: "path-to-be-removed" as UrlPathFragment,
355+
},
339356
};
340357

341358
const vaccineUrlPathToVaccineType = new Map<UrlPathFragment, VaccineType>();
@@ -365,6 +382,7 @@ const childVaccines: VaccineType[] = [
365382
VaccineType.MENB_CHILDREN,
366383
VaccineType.PNEUMOCOCCAL,
367384
VaccineType.HIB_MENC,
385+
VaccineType.FLU_FOR_CHILDREN,
368386
];
369387
const babyVaccines: VaccineType[] = [
370388
VaccineType.VACCINE_6_IN_1,

src/services/content-api/parsers/content-filter-service.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
_removeExcludedHyperlinks,
1010
getFilteredContentForVaccine,
1111
} from "@src/services/content-api/parsers/content-filter-service";
12+
import { getFilteredContentForFluForChildrenVaccine } from "@src/services/content-api/parsers/custom/flu-for-children";
1213
import { getFilteredContentForFluInPregnancyVaccine } from "@src/services/content-api/parsers/custom/flu-in-pregnancy";
1314
import { getFilteredContentForFluVaccine } from "@src/services/content-api/parsers/custom/flu-vaccine";
1415
import { getFilteredContentForWhoopingCoughVaccine } from "@src/services/content-api/parsers/custom/whooping-cough";
@@ -26,6 +27,7 @@ import { contentWithoutBenefitsHealthAspect, contentWithoutCallout } from "@test
2627
jest.mock("@src/services/content-api/parsers/custom/whooping-cough");
2728
jest.mock("@src/services/content-api/parsers/custom/flu-in-pregnancy");
2829
jest.mock("@src/services/content-api/parsers/custom/flu-vaccine");
30+
jest.mock("@src/services/content-api/parsers/custom/flu-for-children");
2931

3032
describe("Content Filter", () => {
3133
describe("_extractDescriptionForVaccine", () => {
@@ -774,6 +776,14 @@ describe("Content Filter", () => {
774776

775777
expect(getFilteredContentForFluInPregnancyVaccine).toHaveBeenCalledWith(mockApiContent);
776778
});
779+
780+
it("should call getFilteredContentForFluForChildrenVaccine for flu for children vaccine", () => {
781+
const mockApiContent = "testContent";
782+
783+
getFilteredContentForVaccine(VaccineType.FLU_FOR_CHILDREN, mockApiContent);
784+
785+
expect(getFilteredContentForFluForChildrenVaccine).toHaveBeenCalledWith(mockApiContent);
786+
});
777787
});
778788
});
779789
});

src/services/content-api/parsers/content-filter-service.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { VaccineType } from "@src/models/vaccine";
22
import { getAdditionalContentForCovid19Vaccine } from "@src/services/content-api/parsers/custom/covid-19";
3+
import { getFilteredContentForFluForChildrenVaccine } from "@src/services/content-api/parsers/custom/flu-for-children";
34
import { getFilteredContentForFluInPregnancyVaccine } from "@src/services/content-api/parsers/custom/flu-in-pregnancy";
45
import { getFilteredContentForFluVaccine } from "@src/services/content-api/parsers/custom/flu-vaccine";
56
import { getFilteredContentForWhoopingCoughVaccine } from "@src/services/content-api/parsers/custom/whooping-cough";
@@ -216,6 +217,8 @@ const getFilteredContentForVaccine = (vaccineType: VaccineType, apiContent: stri
216217
return getFilteredContentForFluInPregnancyVaccine(apiContent);
217218
case VaccineType.FLU_FOR_ADULTS:
218219
return getFilteredContentForFluVaccine(apiContent);
220+
case VaccineType.FLU_FOR_CHILDREN:
221+
return getFilteredContentForFluForChildrenVaccine(apiContent);
219222
case VaccineType.COVID_19:
220223
const standardVaccineContent = getFilteredContentForStandardVaccine(apiContent);
221224
const additionalCovid19VaccineContent = getAdditionalContentForCovid19Vaccine();
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { getFilteredContentForFluForChildrenVaccine } from "@src/services/content-api/parsers/custom/flu-for-children";
2+
import { genericVaccineContentAPIResponse } from "@test-data/content-api/data";
3+
4+
describe("getFilteredContentForFluVaccine", () => {
5+
it("should return overview text from lead paragraph mainEntityOfPage object", async () => {
6+
const expectedOverview = {
7+
overview: { content: "Generic Vaccine Lead Paragraph (overview)", containsHtml: false },
8+
};
9+
10+
const pageCopy = getFilteredContentForFluForChildrenVaccine(JSON.stringify(genericVaccineContentAPIResponse));
11+
12+
expect(pageCopy).toEqual(expect.objectContaining(expectedOverview));
13+
});
14+
15+
it("should return warning callout", () => {
16+
const expected = {
17+
callout: {
18+
heading: "Booking service closed",
19+
content: "Flu vaccine bookings will reopen in autumn 2026",
20+
contentType: "string",
21+
},
22+
};
23+
24+
const pageCopy = getFilteredContentForFluForChildrenVaccine(JSON.stringify(genericVaccineContentAPIResponse));
25+
26+
expect(pageCopy).toEqual(expect.objectContaining(expected));
27+
});
28+
29+
it("should return recommendation", () => {
30+
const expected = {
31+
recommendation: {
32+
heading: "The flu vaccine is recommended for children who:",
33+
content: "* are aged 2 or 3 years (born between September 2021 and 31 August 2023)",
34+
},
35+
};
36+
37+
const pageCopy = getFilteredContentForFluForChildrenVaccine(JSON.stringify(genericVaccineContentAPIResponse));
38+
39+
expect(pageCopy).toEqual(expect.objectContaining(expected));
40+
});
41+
});
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { getFilteredContentForStandardVaccine } from "@src/services/content-api/parsers/content-filter-service";
2+
import { HeadingWithContent, HeadingWithTypedContent, VaccinePageContent } from "@src/services/content-api/types";
3+
4+
export const getFilteredContentForFluForChildrenVaccine = (apiContent: string): VaccinePageContent => {
5+
const standardFilteredContent = getFilteredContentForStandardVaccine(apiContent);
6+
7+
const callout: HeadingWithTypedContent = {
8+
heading: "Booking service closed",
9+
content: "Flu vaccine bookings will reopen in autumn 2026",
10+
contentType: "string",
11+
};
12+
13+
const recommendation: HeadingWithContent = {
14+
heading: "The flu vaccine is recommended for children who:",
15+
content: ["* are aged 2 or 3 years (born between September 2021 and 31 August 2023)"].join("\n"),
16+
};
17+
return { ...standardFilteredContent, callout, recommendation };
18+
};

0 commit comments

Comments
 (0)