Skip to content

Commit 79fe058

Browse files
VIA-184 SB/EO Add Flu for adults callout and recommendation
1 parent f6ea586 commit 79fe058

File tree

3 files changed

+75
-0
lines changed

3 files changed

+75
-0
lines changed

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 { getFilteredContentForFluInPregnancyVaccine } from "@src/services/content-api/parsers/custom/flu-in-pregnancy";
3+
import { getFilteredContentForFluVaccine } from "@src/services/content-api/parsers/custom/flu-vaccine";
34
import { getFilteredContentForWhoopingCoughVaccine } from "@src/services/content-api/parsers/custom/whooping-cough";
45
import {
56
ContentApiVaccineResponse,
@@ -212,6 +213,8 @@ const getFilteredContentForVaccine = (vaccineType: VaccineType, apiContent: stri
212213
return getFilteredContentForWhoopingCoughVaccine(apiContent);
213214
case VaccineType.FLU_IN_PREGNANCY:
214215
return getFilteredContentForFluInPregnancyVaccine(apiContent);
216+
case VaccineType.FLU_FOR_ADULTS:
217+
return getFilteredContentForFluVaccine(apiContent);
215218
default:
216219
return getFilteredContentForStandardVaccine(apiContent);
217220
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import { getFilteredContentForFluVaccine } from "@src/services/content-api/parsers/custom/flu-vaccine";
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 = getFilteredContentForFluVaccine(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 = getFilteredContentForFluVaccine(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 if you:",
33+
content:
34+
"* are aged 65 or older (including those who will be 65 by 31 March 2026\n" +
35+
"* have certain long-term health conditions\n" +
36+
"* are pregnant\n" +
37+
"* live in a care home\n" +
38+
"* are the main carer for an older or disabled person, or receive a carer's allowance\n" +
39+
"* live with someone who has a weakened immune system",
40+
},
41+
};
42+
43+
const pageCopy = getFilteredContentForFluVaccine(JSON.stringify(genericVaccineContentAPIResponse));
44+
45+
expect(pageCopy).toEqual(expect.objectContaining(expected));
46+
});
47+
});
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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 getFilteredContentForFluVaccine = (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 if you:",
15+
content: [
16+
"* are aged 65 or older (including those who will be 65 by 31 March 2026",
17+
"* have certain long-term health conditions",
18+
"* are pregnant",
19+
"* live in a care home",
20+
"* are the main carer for an older or disabled person, or receive a carer's allowance",
21+
"* live with someone who has a weakened immune system",
22+
].join("\n"),
23+
};
24+
return { ...standardFilteredContent, callout, recommendation };
25+
};

0 commit comments

Comments
 (0)