Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion ui/content/ContentValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ const REQUIRED_PAGE_KEYS: (keyof MainPagesContent)[] = [
"how-comfortable-pricking-finger",
"cannot-use-service-under-18",
"enter-mobile-phone-number",
"check-your-answers",
"confirm-mobile-phone-number",
"service-error",
"order-tracking",
"test-results",
Expand All @@ -48,6 +50,22 @@ const REQUIRED_PAGE_KEYS: (keyof MainPagesContent)[] = [
"suppliers-privacy-policy",
];

// order-submitted is required to exist in the content but has no top-level title field,
// so it is kept separate from REQUIRED_PAGE_KEYS to avoid triggering the title assertion.
const REQUIRED_PAGE_PRESENCE_KEYS: ReadonlyArray<keyof MainPagesContent> = [
...REQUIRED_PAGE_KEYS,
"order-submitted",
];

// All main pages that declare a pageTitle field in their schema interface.
// Supplier pages are excluded because they derive their title at render time via formatPageTitle.
const REQUIRED_PAGE_TITLE_KEYS: ReadonlyArray<keyof MainPagesContent> = [
...REQUIRED_PAGE_KEYS.filter(
(k) => k !== "suppliers-terms-conditions" && k !== "suppliers-privacy-policy",
),
"order-submitted",
];
Comment thread
ConnorF-NHS marked this conversation as resolved.

const isObject = (value: unknown): value is Record<string, unknown> =>
typeof value === "object" && value !== null && !Array.isArray(value);

Expand Down Expand Up @@ -86,7 +104,7 @@ const validatePagesContent = (content: unknown, errors: string[]): content is Ma
return false;
}

for (const key of REQUIRED_PAGE_KEYS) {
for (const key of REQUIRED_PAGE_PRESENCE_KEYS) {
if (!(key in content)) {
errors.push(`pages is missing required key: ${key}`);
} else if (!isObject(content[key])) {
Expand All @@ -101,6 +119,13 @@ const validatePagesContent = (content: unknown, errors: string[]): content is Ma
}
}

for (const key of REQUIRED_PAGE_TITLE_KEYS) {
const page = content[key];
if (isObject(page) && !isNonEmptyString(page.pageTitle)) {
errors.push(`pages.${key}.pageTitle must be a non-empty string`);
}
}

return errors.length === 0;
};

Expand Down Expand Up @@ -152,6 +177,9 @@ const assertValidLegalPageContent = (label: string, content: unknown): void => {
if (!isObject(content)) {
throw new Error(`${label} content must be an object`);
}
if (!isNonEmptyString(content["pageTitle"])) {
errors.push("pageTitle must be a non-empty string");
}
if (!isNonEmptyString(content["title"])) {
errors.push("title must be a non-empty string");
}
Expand Down
22 changes: 19 additions & 3 deletions ui/content/content.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
},
"pages": {
"before-you-start": {
"pageTitle": "Before you order a free HIV self-test kit - HomeTest - NHS",
"pageTitle": "Before you order a free HIV self-test kit – HIV Home Test Service – NHS",
"title": "Before you order a free HIV self-test kit",
"urgentCard": {
"heading": "Go to a sexual health clinic if:",
Expand All @@ -141,7 +141,7 @@
"continueButton": "Continue to order a kit"
},
"get-self-test-kit-for-HIV": {
"pageTitle": "Order a free HIV self-test kit - HomeTest - NHS",
"pageTitle": "Order a free HIV self-test kit – HIV Home Test Service – NHS",
"title": "Order a free HIV self-test kit",
"eligibility": {
"intro": "You can use this service if:",
Expand Down Expand Up @@ -200,15 +200,18 @@
}
},
"kit-not-available-in-area": {
"pageTitle": "Free HIV self-test kits are not available in your area using this service – HIV Home Test Service – NHS",
"title": "Free HIV self-test kits are not available in your area using this service",
"description": "There are other options to get an HIV test.",
"moreOptionsHeading": "More options and information"
},
"go-to-clinic": {
"pageTitle": "Contact your nearest sexual health clinic – HIV Home Test Service – NHS",
"title": "Contact your nearest sexual health clinic",
"moreOptionsHeading": "More options and information"
},
"enter-delivery-address": {
"pageTitle": "Enter your delivery address and we'll check if the kit's available – HIV Home Test Service – NHS",
"title": "Enter your delivery address and we'll check if the kit's available",
"form": {
"postcodeLabel": "Postcode",
Expand All @@ -218,6 +221,7 @@
}
},
"enter-address-manually": {
"pageTitle": "Enter your delivery address manually and we'll check if the kit's available – HIV Home Test Service – NHS",
"title": "Enter your delivery address manually and we'll check if the kit's available",
"form": {
"addressLine1Label": "Address line 1",
Expand All @@ -229,17 +233,20 @@
}
},
"no-address-found": {
"pageTitle": "No address found – HIV Home Test Service – NHS",
"title": "No address found",
"notFoundMessage": "We could not find an address that matches",
"tryNewSearchLink": "Try a new search"
},
"select-delivery-address": {
"pageTitle": "Select your delivery address – HIV Home Test Service – NHS",
"title": "found",
"postcodeLabel": "Postcode:",
"editPostcodeLink": "Edit postcode",
"formLabel": "Select your delivery address"
},
"how-comfortable-pricking-finger": {
"pageTitle": "This is what you'll need to do to give a blood sample – HIV Home Test Service – NHS",
"title": "This is what you'll need to do to give a blood sample",
"instructions": "To give a sample of blood, you'll need to:",
"steps": {
Expand All @@ -262,6 +269,7 @@
}
},
"cannot-use-service-under-18": {
"pageTitle": "You cannot use this service as you are under 18 – HIV Home Test Service – NHS",
"title": "You cannot use this service as you are under 18",
"intro": "To get tested for HIV, go to your nearest sexual health clinic, which is:",
"phoneLabel": "Phone:",
Expand All @@ -274,6 +282,7 @@
"learnMoreLinkHref": "https://www.nhs.uk/conditions/hiv-and-aids/"
},
"enter-mobile-phone-number": {
"pageTitle": "What's your mobile phone number? – HIV Home Test Service – NHS",
"title": "What's your mobile phone number?",
"hint": "{supplier} will send updates to this number. It must be your own number.",
"form": {
Expand All @@ -282,7 +291,8 @@
}
},
"confirm-mobile-phone-number": {
"title": "What's your mobile phone number?",
"pageTitle": "Confirm your mobile phone number – HIV Home Test Service – NHS",
"title": "Confirm your mobile phone number",
"hint": "{supplier} will send updates to this number. It must be your own number.",
"form": {
"alternativeLabel": "Use another mobile phone number",
Expand All @@ -292,10 +302,12 @@
"radioLegend": "Confirm your mobile phone number"
},
"service-error": {
"pageTitle": "Sorry, there is a problem with the service – HIV Home Test Service – NHS",
"title": "Sorry, there is a problem with the service",
"message": "Try again later."
},
"order-tracking": {
"pageTitle": "Track your order – HIV Home Test Service – NHS",
"title": "Track your order",
"error": {
"title": "There is a problem",
Expand All @@ -304,6 +316,7 @@
}
},
"test-results": {
"pageTitle": "HIV self-test result – HIV Home Test Service – NHS",
"title": "Test results",
"error": {
"title": "There is a problem",
Expand Down Expand Up @@ -337,6 +350,7 @@
}
},
"blood-sample-guide": {
"pageTitle": "Blood sample step-by-step guide – HIV Home Test Service – NHS",
"title": "Blood sample step-by-step guide",
"whatsInKit": {
"summary": "What's in the kit",
Expand Down Expand Up @@ -509,6 +523,7 @@
}
},
"check-your-answers": {
"pageTitle": "Check your answers before submitting your order – HIV Home Test Service – NHS",
"title": "Check your answers before submitting your order",
"updateMessage": "We'll update you about your HIV test on the account you use for your NHS login.",
"deliveryMessage": "The kit will arrive within 5 working days.",
Expand All @@ -529,6 +544,7 @@
"submitButton": "Submit order"
},
"order-submitted": {
"pageTitle": "Order submitted – HIV Home Test Service – NHS",
"panel": {
"title": "Order submitted",
"referenceNumberPrefix": "Your reference number"
Expand Down
13 changes: 4 additions & 9 deletions ui/content/hometest-privacy-policy.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"pageTitle": "Home test privacy policy – HIV Home Test Service – NHS",
"title": "Hometest Privacy Policy - Draft v1.0 Jan 2026",
"introduction": [
"**[Hometest]** is operated by NHS England [and commissioned by the Department of Health and Social Care (DHSC)].",
Expand All @@ -25,9 +26,7 @@
]
},
{
"paragraphs": [
"Further details are set out in the Hometest Terms of Use [LINK]."
]
"paragraphs": ["Further details are set out in the Hometest Terms of Use [LINK]."]
}
]
},
Expand Down Expand Up @@ -115,9 +114,7 @@
{
"heading": "Health Data",
"inlineHeading": true,
"paragraphs": [
"Special category data may also be collected, including test results."
]
"paragraphs": ["Special category data may also be collected, including test results."]
},
{
"heading": "Technical Data",
Expand All @@ -129,9 +126,7 @@
{
"heading": "Preference Data",
"inlineHeading": true,
"paragraphs": [
"This includes your preferences on receiving communications from us."
]
"paragraphs": ["This includes your preferences on receiving communications from us."]
},
{
"heading": "Usage Data",
Expand Down
11 changes: 3 additions & 8 deletions ui/content/hometest-terms-of-use.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"pageTitle": "Home test terms of use – HIV Home Test Service – NHS",
"title": "Hometest Terms of Use - Draft V1 January 2026",
"introduction": [
"[Hometest] is operated by NHS England [and commissioned by the Department of Health and Social Care (DHSC)]."
Expand Down Expand Up @@ -136,11 +137,7 @@
{
"table": {
"caption": "Name of home testing services with functionality and further information",
"headers": [
"Service",
"Functionality",
"For further information, see:"
],
"headers": ["Service", "Functionality", "For further information, see:"],
"rows": [
[
"Testing Services\n(Hometest App allows you to access the service, but the service is provided outside the Hometest App)",
Expand Down Expand Up @@ -245,9 +242,7 @@
{
"id": "prohibited-uses",
"heading": "10. Prohibited uses",
"paragraphs": [
"10.1. You may not use the Hometest App:"
],
"paragraphs": ["10.1. You may not use the Hometest App:"],
"subsections": [
{
"indented": true,
Expand Down
Loading
Loading