`;
-exports[`SummaryPreviewLetter renders an authoring letter template preview 1`] = `
+exports[`SummaryChooseLetter renders an authoring letter template preview 1`] = `
`;
-
-exports[`SummaryPreviewLetter renders without back links when hideBackLinks is true 1`] = `
-
-
-
-
-
-
-
- Template
-
-
- authoring letter template name
-
-
-
-
-
-
- Template ID
-
-
- authoring-letter-template-id
-
-
-
-
-
- Template type
-
-
- Standard letter
-
-
-
-
-
- Campaign
-
-
- campaign
-
-
-
-
-
- Total pages
-
-
- 2
-
-
-
-
-
- Sheets
-
-
- 1
-
-
-
-
-
- Printing and postage
-
-
- Standard C5
-
-
-
-
-
-
- Example preview
-
-
-
-
-
-
-
-`;
diff --git a/frontend/src/__tests__/components/molecules/__snapshots__/SummaryLetterFromMessagePlan.test.tsx.snap b/frontend/src/__tests__/components/molecules/__snapshots__/SummaryLetterFromMessagePlan.test.tsx.snap
new file mode 100644
index 000000000..b5285b2a4
--- /dev/null
+++ b/frontend/src/__tests__/components/molecules/__snapshots__/SummaryLetterFromMessagePlan.test.tsx.snap
@@ -0,0 +1,163 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`SummaryLetterFromMessagePlan renders an authoring letter template preview 1`] = `
+
+
+
+
+
+
+
+ Template
+
+
+ authoring letter template name
+
+
+
+
+
+
+ Template ID
+
+
+ authoring-letter-template-id
+
+
+
+
+
+ Template type
+
+
+ Standard letter
+
+
+
+
+
+ Campaign
+
+
+
+
+
+
+ Total pages
+
+
+ 2
+
+
+
+
+
+ Sheets
+
+
+ 1
+
+
+
+
+
+ Printing and postage
+
+
+ Standard C5
+
+
+
+
+
+
+ Example preview
+
+
+
+
+
+
+
+`;
diff --git a/frontend/src/app/message-plans/choose-british-sign-language-letter-template/[routingConfigId]/preview-template/[templateId]/page.tsx b/frontend/src/app/message-plans/choose-british-sign-language-letter-template/[routingConfigId]/preview-template/[templateId]/page.tsx
index 01f00eaa1..92868ef3e 100644
--- a/frontend/src/app/message-plans/choose-british-sign-language-letter-template/[routingConfigId]/preview-template/[templateId]/page.tsx
+++ b/frontend/src/app/message-plans/choose-british-sign-language-letter-template/[routingConfigId]/preview-template/[templateId]/page.tsx
@@ -6,7 +6,7 @@ import {
} from 'nhs-notify-web-template-management-utils';
import { Metadata } from 'next';
import content from '@content/content';
-import { SummaryPreviewLetter } from '@molecules/SummaryPreviewLetter/SummaryPreviewLetter';
+import { SummaryChooseLetter } from '@molecules/SummaryChooseLetter/SummaryChooseLetter';
const { pageTitle } = content.pages.previewBritishSignLanguageLetterTemplate;
@@ -21,10 +21,10 @@ const PreviewBritishSignLanguageLetterTemplateFromMessagePlan = async (
) => {
const { routingConfigId } = await props.params;
return (
-
);
};
diff --git a/frontend/src/app/message-plans/choose-large-print-letter-template/[routingConfigId]/preview-template/[templateId]/page.tsx b/frontend/src/app/message-plans/choose-large-print-letter-template/[routingConfigId]/preview-template/[templateId]/page.tsx
index feb42b33d..09a133f00 100644
--- a/frontend/src/app/message-plans/choose-large-print-letter-template/[routingConfigId]/preview-template/[templateId]/page.tsx
+++ b/frontend/src/app/message-plans/choose-large-print-letter-template/[routingConfigId]/preview-template/[templateId]/page.tsx
@@ -4,7 +4,7 @@ import {
} from 'nhs-notify-web-template-management-utils';
import { Metadata } from 'next';
import content from '@content/content';
-import { SummaryPreviewLetter } from '@molecules/SummaryPreviewLetter/SummaryPreviewLetter';
+import { SummaryChooseLetter } from '@molecules/SummaryChooseLetter/SummaryChooseLetter';
const { pageTitle } = content.pages.previewLargePrintLetterTemplate;
@@ -19,10 +19,10 @@ const PreviewLargePrintLetterTemplateFromMessagePlan = async (
) => {
const { routingConfigId } = await props.params;
return (
-
);
};
diff --git a/frontend/src/app/message-plans/choose-other-language-letter-template/[routingConfigId]/preview-template/[templateId]/page.tsx b/frontend/src/app/message-plans/choose-other-language-letter-template/[routingConfigId]/preview-template/[templateId]/page.tsx
index 08e31a918..22911b99d 100644
--- a/frontend/src/app/message-plans/choose-other-language-letter-template/[routingConfigId]/preview-template/[templateId]/page.tsx
+++ b/frontend/src/app/message-plans/choose-other-language-letter-template/[routingConfigId]/preview-template/[templateId]/page.tsx
@@ -4,7 +4,7 @@ import {
} from 'nhs-notify-web-template-management-utils';
import { Metadata } from 'next';
import content from '@content/content';
-import { SummaryPreviewLetter } from '@molecules/SummaryPreviewLetter/SummaryPreviewLetter';
+import { SummaryChooseLetter } from '@molecules/SummaryChooseLetter/SummaryChooseLetter';
const { pageTitle } = content.pages.previewOtherLanguageLetterTemplate;
@@ -19,10 +19,10 @@ const PreviewOtherLanguageLetterTemplateFromMessagePlan = async (
) => {
const { routingConfigId } = await props.params;
return (
-
);
};
diff --git a/frontend/src/app/message-plans/choose-standard-english-letter-template/[routingConfigId]/preview-template/[templateId]/page.tsx b/frontend/src/app/message-plans/choose-standard-english-letter-template/[routingConfigId]/preview-template/[templateId]/page.tsx
index 4e26815ed..5821e8756 100644
--- a/frontend/src/app/message-plans/choose-standard-english-letter-template/[routingConfigId]/preview-template/[templateId]/page.tsx
+++ b/frontend/src/app/message-plans/choose-standard-english-letter-template/[routingConfigId]/preview-template/[templateId]/page.tsx
@@ -4,7 +4,7 @@ import {
} from 'nhs-notify-web-template-management-utils';
import { Metadata } from 'next';
import content from '@content/content';
-import { SummaryPreviewLetter } from '@molecules/SummaryPreviewLetter/SummaryPreviewLetter';
+import { SummaryChooseLetter } from '@molecules/SummaryChooseLetter/SummaryChooseLetter';
const { pageTitle } = content.pages.previewStandardEnglishLetterTemplate;
@@ -19,10 +19,10 @@ const PreviewStandardEnglishLetterTemplateFromMessagePlan = async (
) => {
const { routingConfigId } = await props.params;
return (
-
);
};
diff --git a/frontend/src/app/message-plans/preview-message-plan/[routingConfigId]/preview-template/[templateId]/page.tsx b/frontend/src/app/message-plans/preview-message-plan/[routingConfigId]/preview-template/[templateId]/page.tsx
index 9b62b2215..81f4cea08 100644
--- a/frontend/src/app/message-plans/preview-message-plan/[routingConfigId]/preview-template/[templateId]/page.tsx
+++ b/frontend/src/app/message-plans/preview-message-plan/[routingConfigId]/preview-template/[templateId]/page.tsx
@@ -4,7 +4,7 @@ import {
} from 'nhs-notify-web-template-management-utils';
import { Metadata } from 'next';
import content from '@content/content';
-import { SummaryPreviewLetter } from '@molecules/SummaryPreviewLetter/SummaryPreviewLetter';
+import { SummaryLetterFromMessagePlan } from '@molecules/SummaryLetterFromMessagePlan/SummaryLetterFromMessagePlan';
const { pageTitle } = content.pages.previewMessagePlanPreviewLetter;
@@ -17,10 +17,9 @@ export async function generateMetadata(): Promise
{
const PreviewLetterTemplateFromPreviewMessagePlan = async (
props: MessagePlanAndTemplatePageProps
) => (
-
);
diff --git a/frontend/src/app/message-plans/review-and-move-to-production/[routingConfigId]/preview-template/[templateId]/page.tsx b/frontend/src/app/message-plans/review-and-move-to-production/[routingConfigId]/preview-template/[templateId]/page.tsx
index eca1d1942..b3723ca56 100644
--- a/frontend/src/app/message-plans/review-and-move-to-production/[routingConfigId]/preview-template/[templateId]/page.tsx
+++ b/frontend/src/app/message-plans/review-and-move-to-production/[routingConfigId]/preview-template/[templateId]/page.tsx
@@ -4,7 +4,7 @@ import {
} from 'nhs-notify-web-template-management-utils';
import { Metadata } from 'next';
import content from '@content/content';
-import { SummaryPreviewLetter } from '@molecules/SummaryPreviewLetter/SummaryPreviewLetter';
+import { SummaryLetterFromMessagePlan } from '@molecules/SummaryLetterFromMessagePlan/SummaryLetterFromMessagePlan';
const { pageTitle } = content.pages.reviewAndMoveToProductionPreviewLetter;
@@ -17,10 +17,9 @@ export async function generateMetadata(): Promise {
const PreviewLetterTemplateFromReviewAndMoveToProduction = async (
props: MessagePlanAndTemplatePageProps
) => (
-
);
diff --git a/frontend/src/components/molecules/SummaryPreviewLetter/SummaryPreviewLetter.tsx b/frontend/src/components/molecules/SummaryChooseLetter/SummaryChooseLetter.tsx
similarity index 71%
rename from frontend/src/components/molecules/SummaryPreviewLetter/SummaryPreviewLetter.tsx
rename to frontend/src/components/molecules/SummaryChooseLetter/SummaryChooseLetter.tsx
index 11e777c8d..f918c60f7 100644
--- a/frontend/src/components/molecules/SummaryPreviewLetter/SummaryPreviewLetter.tsx
+++ b/frontend/src/components/molecules/SummaryChooseLetter/SummaryChooseLetter.tsx
@@ -11,31 +11,24 @@ import PreviewTemplateDetailsLetter from '@molecules/PreviewTemplateDetails/Prev
import { $LockNumber } from 'nhs-notify-backend-client/schemas';
import { NHSNotifyContainer } from '@layouts/container/container';
-type SummaryPreviewLetterProps = MessagePlanAndTemplatePageProps & {
+type SummaryChooseLetterProps = MessagePlanAndTemplatePageProps & {
validateTemplate: (template?: TemplateDto) => LetterTemplate | undefined;
- hideBackLinks?: boolean;
- redirectUrl?: string;
+ redirectUrlOnLockNumberFailure: string;
};
-export const SummaryPreviewLetter = async (
- props: SummaryPreviewLetterProps
-) => {
+export const SummaryChooseLetter = async (props: SummaryChooseLetterProps) => {
const { templateId, routingConfigId } = await props.params;
- const { validateTemplate, hideBackLinks, redirectUrl } = props;
+ const { validateTemplate, redirectUrlOnLockNumberFailure } = props;
- let lockNumber: number | undefined;
+ const searchParams = await props.searchParams;
+ const lockNumberResult = $LockNumber.safeParse(searchParams?.lockNumber);
- if (redirectUrl) {
- const searchParams = await props.searchParams;
- const lockNumberResult = $LockNumber.safeParse(searchParams?.lockNumber);
-
- if (!lockNumberResult.success) {
- return redirect(redirectUrl, RedirectType.replace);
- }
-
- lockNumber = lockNumberResult.data;
+ if (!lockNumberResult.success) {
+ return redirect(redirectUrlOnLockNumberFailure, RedirectType.replace);
}
+ const lockNumber = lockNumberResult.data;
+
const template = await getTemplate(templateId);
const validatedTemplate = validateTemplate(template);
@@ -59,7 +52,6 @@ export const SummaryPreviewLetter = async (
routingConfigId={routingConfigId}
lockNumber={lockNumber}
letterVariant={letterVariant}
- hideBackLinks={hideBackLinks}
/>
);
diff --git a/frontend/src/components/molecules/SummaryLetterFromMessagePlan/SummaryLetterFromMessagePlan.tsx b/frontend/src/components/molecules/SummaryLetterFromMessagePlan/SummaryLetterFromMessagePlan.tsx
new file mode 100644
index 000000000..c11646fbe
--- /dev/null
+++ b/frontend/src/components/molecules/SummaryLetterFromMessagePlan/SummaryLetterFromMessagePlan.tsx
@@ -0,0 +1,49 @@
+import {
+ AuthoringLetterTemplate,
+ LetterTemplate,
+ MessagePlanAndTemplatePageProps,
+} from 'nhs-notify-web-template-management-utils';
+import type { TemplateDto } from 'nhs-notify-web-template-management-types';
+import { getLetterVariantById, getTemplate } from '@utils/form-actions';
+import { redirect, RedirectType } from 'next/navigation';
+import { PreviewTemplateFromMessagePlan } from '@molecules/PreviewTemplateFromMessagePlan/PreviewTemplateFromMessagePlan';
+import PreviewTemplateDetailsLetter from '@molecules/PreviewTemplateDetails/PreviewTemplateDetailsLetter';
+import { NHSNotifyContainer } from '@layouts/container/container';
+
+type SummaryLetterFromMessagePlanProps = MessagePlanAndTemplatePageProps & {
+ validateTemplate: (template?: TemplateDto) => LetterTemplate | undefined;
+};
+
+export const SummaryLetterFromMessagePlan = async (
+ props: SummaryLetterFromMessagePlanProps
+) => {
+ const { templateId, routingConfigId } = await props.params;
+ const { validateTemplate } = props;
+
+ const template = await getTemplate(templateId);
+
+ const validatedTemplate = validateTemplate(template);
+
+ if (!validatedTemplate) {
+ return redirect('/invalid-template', RedirectType.replace);
+ }
+
+ const letterVariantId = (validatedTemplate as AuthoringLetterTemplate)
+ .letterVariantId;
+
+ const letterVariant = letterVariantId
+ ? await getLetterVariantById(letterVariantId)
+ : undefined;
+
+ return (
+
+
+
+ );
+};
diff --git a/infrastructure/terraform/modules/backend-api/spec.tmpl.json b/infrastructure/terraform/modules/backend-api/spec.tmpl.json
index 5ead94504..3c5096b45 100644
--- a/infrastructure/terraform/modules/backend-api/spec.tmpl.json
+++ b/infrastructure/terraform/modules/backend-api/spec.tmpl.json
@@ -411,10 +411,10 @@
"digitalProofingSms": {
"type": "boolean"
},
- "letterAuthoring": {
+ "legacyLetters": {
"type": "boolean"
},
- "legacyLetters": {
+ "letterAuthoring": {
"type": "boolean"
},
"proofing": {
diff --git a/package.json b/package.json
index 7cef783ed..bf54db2c0 100644
--- a/package.json
+++ b/package.json
@@ -28,6 +28,9 @@
},
"name": "nhs-notify-web-template-management",
"overrides": {
+ "@aws-sdk/xml-builder": {
+ "fast-xml-parser": "5.5.6"
+ },
"fast-xml-parser": "^5.5.6",
"flatted": "^3.4.0",
"immutable": "^5.1.5",
@@ -38,10 +41,7 @@
"react-is": "19.0.0"
},
"react": "^19.0.0",
- "underscore": "^1.13.8",
- "@aws-sdk/xml-builder": {
- "fast-xml-parser": "5.5.6"
- }
+ "underscore": "^1.13.8"
},
"scripts": {
"build": "npm run create-env-file && npm run build --workspace frontend",
diff --git a/packages/event-schemas/examples/ProofRequested/v1/email.json b/packages/event-schemas/examples/ProofRequested/v1/email.json
index 63fa0783b..7c5d33918 100644
--- a/packages/event-schemas/examples/ProofRequested/v1/email.json
+++ b/packages/event-schemas/examples/ProofRequested/v1/email.json
@@ -1,16 +1,16 @@
{
"data": {
- "id": "c3d4e5f6-a7b8-4012-8def-123456789012",
- "templateId": "8c7ae592-97cd-4900-897e-ef4794c8a745",
- "templateType": "EMAIL",
- "testPatientNhsNumber": "9000000009",
"contactDetails": {
"email": "test.patient@example.com"
},
+ "id": "c3d4e5f6-a7b8-4012-8def-123456789012",
"personalisation": {
"firstName": "Jane",
"surgeryName": "Test Surgery"
- }
+ },
+ "templateId": "8c7ae592-97cd-4900-897e-ef4794c8a745",
+ "templateType": "EMAIL",
+ "testPatientNhsNumber": "9000000009"
},
"datacontenttype": "application/json",
"dataschema": "https://notify.nhs.uk/events/schemas/ProofRequested/v1.json",
diff --git a/packages/event-schemas/examples/ProofRequested/v1/nhsapp.json b/packages/event-schemas/examples/ProofRequested/v1/nhsapp.json
index 063600877..e5f39efe8 100644
--- a/packages/event-schemas/examples/ProofRequested/v1/nhsapp.json
+++ b/packages/event-schemas/examples/ProofRequested/v1/nhsapp.json
@@ -1,15 +1,15 @@
{
"data": {
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
- "templateId": "3a58a370-75ab-4788-a75e-cd2572a68523",
- "templateType": "NHS_APP",
- "testPatientNhsNumber": "9000000009",
"personalisation": {
- "firstName": "Jane",
- "appointmentTime": "10:00",
"appointmentDate": "2025-08-01",
+ "appointmentTime": "10:00",
+ "firstName": "Jane",
"surgeryName": "Test Surgery"
- }
+ },
+ "templateId": "3a58a370-75ab-4788-a75e-cd2572a68523",
+ "templateType": "NHS_APP",
+ "testPatientNhsNumber": "9000000009"
},
"datacontenttype": "application/json",
"dataschema": "https://notify.nhs.uk/events/schemas/ProofRequested/v1.json",
diff --git a/packages/event-schemas/examples/ProofRequested/v1/sms.json b/packages/event-schemas/examples/ProofRequested/v1/sms.json
index a80d05afc..68e63070c 100644
--- a/packages/event-schemas/examples/ProofRequested/v1/sms.json
+++ b/packages/event-schemas/examples/ProofRequested/v1/sms.json
@@ -1,15 +1,15 @@
{
"data": {
- "id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
- "templateId": "7b69c481-86bc-5899-b86f-de3683b79634",
- "templateType": "SMS",
- "testPatientNhsNumber": "9000000009",
"contactDetails": {
"sms": "07700900000"
},
+ "id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"personalisation": {
"firstName": "Jane"
- }
+ },
+ "templateId": "7b69c481-86bc-5899-b86f-de3683b79634",
+ "templateType": "SMS",
+ "testPatientNhsNumber": "9000000009"
},
"datacontenttype": "application/json",
"dataschema": "https://notify.nhs.uk/events/schemas/ProofRequested/v1.json",
From 0fe27b0524ce1b98e068f8ef27ab1afcffaa09f4 Mon Sep 17 00:00:00 2001
From: "alex.nuttall1"
Date: Wed, 8 Apr 2026 13:24:00 +0100
Subject: [PATCH 49/57] bump events version
---
packages/event-schemas/package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/event-schemas/package.json b/packages/event-schemas/package.json
index 019942e26..463022a25 100644
--- a/packages/event-schemas/package.json
+++ b/packages/event-schemas/package.json
@@ -56,5 +56,5 @@
},
"type": "commonjs",
"types": "./dist/index.d.ts",
- "version": "1.4.6"
+ "version": "1.4.7"
}
From 245d6f036cc435a6ec62e864923d3c58fc1a4880 Mon Sep 17 00:00:00 2001
From: "alex.nuttall1"
Date: Wed, 8 Apr 2026 15:15:52 +0100
Subject: [PATCH 50/57] revert reformatting due to commit hook
---
.../terraform/modules/backend-api/spec.tmpl.json | 4 ++--
package.json | 8 ++++----
.../examples/ProofRequested/v1/email.json | 10 +++++-----
.../examples/ProofRequested/v1/nhsapp.json | 12 ++++++------
.../examples/ProofRequested/v1/sms.json | 10 +++++-----
packages/event-schemas/package.json | 2 +-
scripts/config/pre-commit.yaml | 4 ++--
7 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/infrastructure/terraform/modules/backend-api/spec.tmpl.json b/infrastructure/terraform/modules/backend-api/spec.tmpl.json
index 3c5096b45..5ead94504 100644
--- a/infrastructure/terraform/modules/backend-api/spec.tmpl.json
+++ b/infrastructure/terraform/modules/backend-api/spec.tmpl.json
@@ -411,10 +411,10 @@
"digitalProofingSms": {
"type": "boolean"
},
- "legacyLetters": {
+ "letterAuthoring": {
"type": "boolean"
},
- "letterAuthoring": {
+ "legacyLetters": {
"type": "boolean"
},
"proofing": {
diff --git a/package.json b/package.json
index bf54db2c0..7cef783ed 100644
--- a/package.json
+++ b/package.json
@@ -28,9 +28,6 @@
},
"name": "nhs-notify-web-template-management",
"overrides": {
- "@aws-sdk/xml-builder": {
- "fast-xml-parser": "5.5.6"
- },
"fast-xml-parser": "^5.5.6",
"flatted": "^3.4.0",
"immutable": "^5.1.5",
@@ -41,7 +38,10 @@
"react-is": "19.0.0"
},
"react": "^19.0.0",
- "underscore": "^1.13.8"
+ "underscore": "^1.13.8",
+ "@aws-sdk/xml-builder": {
+ "fast-xml-parser": "5.5.6"
+ }
},
"scripts": {
"build": "npm run create-env-file && npm run build --workspace frontend",
diff --git a/packages/event-schemas/examples/ProofRequested/v1/email.json b/packages/event-schemas/examples/ProofRequested/v1/email.json
index 7c5d33918..63fa0783b 100644
--- a/packages/event-schemas/examples/ProofRequested/v1/email.json
+++ b/packages/event-schemas/examples/ProofRequested/v1/email.json
@@ -1,16 +1,16 @@
{
"data": {
+ "id": "c3d4e5f6-a7b8-4012-8def-123456789012",
+ "templateId": "8c7ae592-97cd-4900-897e-ef4794c8a745",
+ "templateType": "EMAIL",
+ "testPatientNhsNumber": "9000000009",
"contactDetails": {
"email": "test.patient@example.com"
},
- "id": "c3d4e5f6-a7b8-4012-8def-123456789012",
"personalisation": {
"firstName": "Jane",
"surgeryName": "Test Surgery"
- },
- "templateId": "8c7ae592-97cd-4900-897e-ef4794c8a745",
- "templateType": "EMAIL",
- "testPatientNhsNumber": "9000000009"
+ }
},
"datacontenttype": "application/json",
"dataschema": "https://notify.nhs.uk/events/schemas/ProofRequested/v1.json",
diff --git a/packages/event-schemas/examples/ProofRequested/v1/nhsapp.json b/packages/event-schemas/examples/ProofRequested/v1/nhsapp.json
index e5f39efe8..063600877 100644
--- a/packages/event-schemas/examples/ProofRequested/v1/nhsapp.json
+++ b/packages/event-schemas/examples/ProofRequested/v1/nhsapp.json
@@ -1,15 +1,15 @@
{
"data": {
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
+ "templateId": "3a58a370-75ab-4788-a75e-cd2572a68523",
+ "templateType": "NHS_APP",
+ "testPatientNhsNumber": "9000000009",
"personalisation": {
- "appointmentDate": "2025-08-01",
- "appointmentTime": "10:00",
"firstName": "Jane",
+ "appointmentTime": "10:00",
+ "appointmentDate": "2025-08-01",
"surgeryName": "Test Surgery"
- },
- "templateId": "3a58a370-75ab-4788-a75e-cd2572a68523",
- "templateType": "NHS_APP",
- "testPatientNhsNumber": "9000000009"
+ }
},
"datacontenttype": "application/json",
"dataschema": "https://notify.nhs.uk/events/schemas/ProofRequested/v1.json",
diff --git a/packages/event-schemas/examples/ProofRequested/v1/sms.json b/packages/event-schemas/examples/ProofRequested/v1/sms.json
index 68e63070c..a80d05afc 100644
--- a/packages/event-schemas/examples/ProofRequested/v1/sms.json
+++ b/packages/event-schemas/examples/ProofRequested/v1/sms.json
@@ -1,15 +1,15 @@
{
"data": {
+ "id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
+ "templateId": "7b69c481-86bc-5899-b86f-de3683b79634",
+ "templateType": "SMS",
+ "testPatientNhsNumber": "9000000009",
"contactDetails": {
"sms": "07700900000"
},
- "id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"personalisation": {
"firstName": "Jane"
- },
- "templateId": "7b69c481-86bc-5899-b86f-de3683b79634",
- "templateType": "SMS",
- "testPatientNhsNumber": "9000000009"
+ }
},
"datacontenttype": "application/json",
"dataschema": "https://notify.nhs.uk/events/schemas/ProofRequested/v1.json",
diff --git a/packages/event-schemas/package.json b/packages/event-schemas/package.json
index 463022a25..019942e26 100644
--- a/packages/event-schemas/package.json
+++ b/packages/event-schemas/package.json
@@ -56,5 +56,5 @@
},
"type": "commonjs",
"types": "./dist/index.d.ts",
- "version": "1.4.7"
+ "version": "1.4.6"
}
diff --git a/scripts/config/pre-commit.yaml b/scripts/config/pre-commit.yaml
index 4e757008d..79d121c0b 100644
--- a/scripts/config/pre-commit.yaml
+++ b/scripts/config/pre-commit.yaml
@@ -19,8 +19,8 @@ repos:
- id: pretty-format-json
exclude: |
(?x)^(
- .*/?package-lock.json |
- packages/event-schemas/schemas/[^/]+/[^/]+\.json
+ (^|/)package-lock\.json$ |
+ ^packages/event-schemas/schemas/[^/]+/[^/]+\.json$
)$
args: ['--autofix']
From 6b20f340cb23d569debbc7650637fbcd74a2ff07 Mon Sep 17 00:00:00 2001
From: "alex.nuttall1"
Date: Wed, 8 Apr 2026 15:16:09 +0100
Subject: [PATCH 51/57] revert reformatting due to commit hook
From 26b4eb80082f4e59e9e09194869e95779e8c489c Mon Sep 17 00:00:00 2001
From: "alex.nuttall1"
Date: Wed, 8 Apr 2026 19:02:37 +0100
Subject: [PATCH 52/57] rm pdf letters support from routing code
---
.../__snapshots__/page.test.tsx.snap | 22 +--
.../page.test.tsx | 7 +-
.../__snapshots__/page.test.tsx.snap | 14 +-
.../preview-message-plan/page.test.tsx | 63 +--------
.../preview-template/page.test.tsx | 8 +-
.../__snapshots__/page.test.tsx.snap | 16 +--
.../page.test.tsx | 48 +------
.../preview-template/page.test.tsx | 8 +-
.../ChooseChannelTemplate.test.tsx | 4 +-
.../ChooseChannelTemplate.test.tsx.snap | 22 +--
.../MessagePlanCascadePreview.test.tsx | 113 +++-------------
.../molecules/SummaryChooseLetter.test.tsx | 26 +---
.../MessagePlanCascadePreview.test.tsx.snap | 4 +-
.../SummaryChooseLetter.test.tsx.snap | 126 +-----------------
frontend/src/__tests__/helpers/helpers.ts | 2 +-
.../preview-template/[templateId]/page.tsx | 12 +-
.../preview-template/[templateId]/page.tsx | 12 +-
.../MessagePlanCascadePreview.tsx | 16 +--
.../SummaryChooseLetter.tsx | 20 +--
.../SummaryLetterFromMessagePlan.tsx | 24 +---
.../routing.e2e.spec.ts | 17 ++-
...-letter-template.routing-component.spec.ts | 23 ++--
...-letter-template.routing-component.spec.ts | 81 +++--------
...-letter-template.routing-component.spec.ts | 88 +++---------
...-letter-template.routing-component.spec.ts | 61 +++------
...-letter-template.routing-component.spec.ts | 33 ++---
...iew-message-plan.routing-component.spec.ts | 85 ++++--------
...-letter-template.routing-component.spec.ts | 33 ++---
...ve-to-production.routing-component.spec.ts | 72 +++-------
29 files changed, 250 insertions(+), 810 deletions(-)
diff --git a/frontend/src/__tests__/app/message-plans/choose-standard-english-letter-template/__snapshots__/page.test.tsx.snap b/frontend/src/__tests__/app/message-plans/choose-standard-english-letter-template/__snapshots__/page.test.tsx.snap
index 149ec95f3..a2d4fb717 100644
--- a/frontend/src/__tests__/app/message-plans/choose-standard-english-letter-template/__snapshots__/page.test.tsx.snap
+++ b/frontend/src/__tests__/app/message-plans/choose-standard-english-letter-template/__snapshots__/page.test.tsx.snap
@@ -66,7 +66,7 @@ exports[`ChooseStandardEnglishLetterTemplate page renders letter template select
- letter template name
+ authoring letter template name
@@ -156,19 +156,19 @@ exports[`ChooseStandardEnglishLetterTemplate page renders letter template select
class="nhsuk-radios__item"
>
@@ -176,7 +176,7 @@ exports[`ChooseStandardEnglishLetterTemplate page renders letter template select
Name
- letter template name
+ authoring letter template name
Preview
diff --git a/frontend/src/__tests__/app/message-plans/choose-standard-english-letter-template/page.test.tsx b/frontend/src/__tests__/app/message-plans/choose-standard-english-letter-template/page.test.tsx
index 83ef9b8cf..72db01cce 100644
--- a/frontend/src/__tests__/app/message-plans/choose-standard-english-letter-template/page.test.tsx
+++ b/frontend/src/__tests__/app/message-plans/choose-standard-english-letter-template/page.test.tsx
@@ -1,7 +1,10 @@
import ChooseStandardEnglishLetterTemplate, {
generateMetadata,
} from '@app/message-plans/choose-standard-english-letter-template/[routingConfigId]/page';
-import { PDF_LETTER_TEMPLATE, ROUTING_CONFIG } from '@testhelpers/helpers';
+import {
+ AUTHORING_LETTER_TEMPLATE,
+ ROUTING_CONFIG,
+} from '@testhelpers/helpers';
import { render } from '@testing-library/react';
import { getTemplates } from '@utils/form-actions';
import { getRoutingConfig } from '@utils/message-plans';
@@ -63,7 +66,7 @@ describe('ChooseStandardEnglishLetterTemplate page', () => {
it('renders letter template selection', async () => {
getRoutingConfigMock.mockResolvedValueOnce(ROUTING_CONFIG);
- getTemplatesMock.mockResolvedValueOnce([PDF_LETTER_TEMPLATE]);
+ getTemplatesMock.mockResolvedValueOnce([AUTHORING_LETTER_TEMPLATE]);
const page = await ChooseStandardEnglishLetterTemplate({
params: Promise.resolve({
diff --git a/frontend/src/__tests__/app/message-plans/preview-message-plan/__snapshots__/page.test.tsx.snap b/frontend/src/__tests__/app/message-plans/preview-message-plan/__snapshots__/page.test.tsx.snap
index 02b9160d2..6cf6ce8e7 100644
--- a/frontend/src/__tests__/app/message-plans/preview-message-plan/__snapshots__/page.test.tsx.snap
+++ b/frontend/src/__tests__/app/message-plans/preview-message-plan/__snapshots__/page.test.tsx.snap
@@ -606,10 +606,10 @@ exports[`full cascade plan matches snapshot 1`] = `
- letter template name
+ authoring letter template name
@@ -725,7 +725,7 @@ exports[`full cascade plan matches snapshot 1`] = `
large print letter template name
@@ -784,11 +784,11 @@ exports[`full cascade plan matches snapshot 1`] = `
- letter template name
+ authoring letter template name
@@ -797,11 +797,11 @@ exports[`full cascade plan matches snapshot 1`] = `
- letter template name
+ authoring letter template name
diff --git a/frontend/src/__tests__/app/message-plans/preview-message-plan/page.test.tsx b/frontend/src/__tests__/app/message-plans/preview-message-plan/page.test.tsx
index 9d90094c5..263c4b0eb 100644
--- a/frontend/src/__tests__/app/message-plans/preview-message-plan/page.test.tsx
+++ b/frontend/src/__tests__/app/message-plans/preview-message-plan/page.test.tsx
@@ -15,7 +15,6 @@ import {
EMAIL_TEMPLATE,
LARGE_PRINT_LETTER_TEMPLATE,
NHS_APP_TEMPLATE,
- PDF_LETTER_TEMPLATE,
SMS_TEMPLATE,
} from '@testhelpers/helpers';
import { RoutingConfigFactory } from '@testhelpers/routing-config-factory';
@@ -60,7 +59,6 @@ const kuTemplateId = '31399023-08a2-4dc7-81c7-e25b284b2aab';
const sqTemplateId = '35746144-cac4-4e1f-b92b-4f58e9f1154f';
const largePrintTemplateId = '72ebc15c-d950-4e2e-99d4-3de7f174fba6';
const bslTemplateId = 'a4e82c0f-3b91-47d5-86e2-5c9f1a7d3b04';
-const authoringLetterTemplateId = '770ed5da-765d-431c-b4b4-4068d11ffed1';
const templates: MessagePlanTemplates = {
[appTemplateId]: {
@@ -79,17 +77,17 @@ const templates: MessagePlanTemplates = {
templateStatus: 'SUBMITTED',
},
[letterTemplateId]: {
- ...PDF_LETTER_TEMPLATE,
+ ...AUTHORING_LETTER_TEMPLATE,
id: letterTemplateId,
templateStatus: 'SUBMITTED',
},
[kuTemplateId]: {
- ...PDF_LETTER_TEMPLATE,
+ ...AUTHORING_LETTER_TEMPLATE,
id: kuTemplateId,
templateStatus: 'SUBMITTED',
},
[sqTemplateId]: {
- ...PDF_LETTER_TEMPLATE,
+ ...AUTHORING_LETTER_TEMPLATE,
id: sqTemplateId,
templateStatus: 'SUBMITTED',
},
@@ -103,11 +101,6 @@ const templates: MessagePlanTemplates = {
id: bslTemplateId,
templateStatus: 'SUBMITTED',
},
- [authoringLetterTemplateId]: {
- ...AUTHORING_LETTER_TEMPLATE,
- id: authoringLetterTemplateId,
- templateStatus: 'PROOF_APPROVED',
- },
};
beforeEach(() => {
@@ -355,7 +348,7 @@ describe.each(digitalChannels)(
);
describe('letter only', () => {
- it('shows only the card for the default template when no conditional templates are included (PDF letter)', async () => {
+ it('shows only the card for the default template when no conditional templates are included', async () => {
const routingConfig = createRoutingConfig({
cascade: [
{
@@ -389,50 +382,6 @@ describe('letter only', () => {
expect(link).toHaveTextContent('Preview template (opens in a new tab)');
- expect(link).toHaveAttribute(
- 'href',
- `/preview-submitted-letter-template/${template.id}`
- );
-
- expect(
- within(block).queryByTestId('conditional-templates')
- ).not.toBeInTheDocument();
- });
-
- it('shows only the card for the default template when no conditional templates are included (AUTHORING letter)', async () => {
- const routingConfig = createRoutingConfig({
- cascade: [
- {
- channel: 'LETTER',
- channelType: 'primary',
- defaultTemplateId: authoringLetterTemplateId,
- cascadeGroups: ['standard'],
- },
- ],
- });
-
- const template = templates[authoringLetterTemplateId];
-
- await renderPage(routingConfig);
-
- expect(
- screen.queryByRole('button', {
- name: 'Open all digital template previews',
- })
- ).not.toBeInTheDocument();
-
- const block = screen.getByTestId('message-plan-block-LETTER');
-
- const card = within(block).getByTestId('channel-card');
-
- const name = within(card).getByTestId('template-name');
-
- expect(name).toHaveTextContent(template.name);
-
- const link = within(card).getByRole('link');
-
- expect(link).toHaveTextContent('Preview template (opens in a new tab)');
-
expect(link).toHaveAttribute(
'href',
`/message-plans/preview-message-plan/${routingConfig.id}/preview-template/${template.id}`
@@ -490,7 +439,7 @@ describe('letter only', () => {
expect(link).toHaveAttribute(
'href',
- `/preview-submitted-letter-template/${template.id}`
+ `/message-plans/preview-message-plan/${routingConfig.id}/preview-template/${template.id}`
);
expect(link).toHaveAttribute('target', '_blank');
@@ -602,7 +551,7 @@ describe('letter only', () => {
expect(links[index]).toHaveAttribute(
'href',
- `/preview-submitted-letter-template/${template.id}`
+ `/message-plans/preview-message-plan/${routingConfig.id}/preview-template/${template.id}`
);
expect(links[index]).toHaveAttribute('target', '_blank');
diff --git a/frontend/src/__tests__/app/message-plans/preview-message-plan/preview-template/page.test.tsx b/frontend/src/__tests__/app/message-plans/preview-message-plan/preview-template/page.test.tsx
index f6a86979d..c07309d1b 100644
--- a/frontend/src/__tests__/app/message-plans/preview-message-plan/preview-template/page.test.tsx
+++ b/frontend/src/__tests__/app/message-plans/preview-message-plan/preview-template/page.test.tsx
@@ -5,7 +5,6 @@ import PreviewLetterTemplateFromPreviewMessagePlan, {
generateMetadata,
} from '@app/message-plans/preview-message-plan/[routingConfigId]/preview-template/[templateId]/page';
import { SummaryLetterFromMessagePlan } from '@molecules/SummaryLetterFromMessagePlan/SummaryLetterFromMessagePlan';
-import { validateAuthoringLetterTemplate } from 'nhs-notify-web-template-management-utils';
jest.mock(
'@molecules/SummaryLetterFromMessagePlan/SummaryLetterFromMessagePlan'
@@ -22,12 +21,7 @@ describe('PreviewLetterTemplateFromPreviewMessagePlan page', () => {
const page = await PreviewLetterTemplateFromPreviewMessagePlan(props);
- expect(page).toEqual(
-
- );
+ expect(page).toEqual( );
});
it('should have the correct page title', async () => {
diff --git a/frontend/src/__tests__/app/message-plans/review-and-move-to-production/__snapshots__/page.test.tsx.snap b/frontend/src/__tests__/app/message-plans/review-and-move-to-production/__snapshots__/page.test.tsx.snap
index 9a14747a1..e9ea3c67c 100644
--- a/frontend/src/__tests__/app/message-plans/review-and-move-to-production/__snapshots__/page.test.tsx.snap
+++ b/frontend/src/__tests__/app/message-plans/review-and-move-to-production/__snapshots__/page.test.tsx.snap
@@ -557,10 +557,10 @@ exports[`Review and move to production page matches snapshot for full cascade 1`
- letter template name
+ authoring letter template name
@@ -673,10 +673,10 @@ exports[`Review and move to production page matches snapshot for full cascade 1`
- authoring letter template name
+ large print letter template name
@@ -735,11 +735,11 @@ exports[`Review and move to production page matches snapshot for full cascade 1`
- letter template name
+ authoring letter template name
@@ -748,11 +748,11 @@ exports[`Review and move to production page matches snapshot for full cascade 1`
- letter template name
+ authoring letter template name
diff --git a/frontend/src/__tests__/app/message-plans/review-and-move-to-production/page.test.tsx b/frontend/src/__tests__/app/message-plans/review-and-move-to-production/page.test.tsx
index 1066bf210..1303193ab 100644
--- a/frontend/src/__tests__/app/message-plans/review-and-move-to-production/page.test.tsx
+++ b/frontend/src/__tests__/app/message-plans/review-and-move-to-production/page.test.tsx
@@ -9,7 +9,6 @@ import {
EMAIL_TEMPLATE,
LARGE_PRINT_LETTER_TEMPLATE,
NHS_APP_TEMPLATE,
- PDF_LETTER_TEMPLATE,
SMS_TEMPLATE,
AUTHORING_LETTER_TEMPLATE,
} from '@testhelpers/helpers';
@@ -62,26 +61,20 @@ const letterTemplateId = '278e1a92-353f-42a3-b08d-565ea1c9d763';
const kuTemplateId = '31399023-08a2-4dc7-81c7-e25b284b2aab';
const sqTemplateId = '35746144-cac4-4e1f-b92b-4f58e9f1154f';
const largePrintTemplateId = '72ebc15c-d950-4e2e-99d4-3de7f174fba6';
-const authoringLetterTemplateId = '770ed5da-765d-431c-b4b4-4068d11ffed1';
const bslTemplateId = 'c7d93e1a-4b05-48f6-97a3-6d2e3b8c5f17';
const templates: MessagePlanTemplates = {
[appTemplateId]: { ...NHS_APP_TEMPLATE, id: appTemplateId },
[emailTemplateId]: { ...EMAIL_TEMPLATE, id: emailTemplateId },
[smsTemplateId]: { ...SMS_TEMPLATE, id: smsTemplateId },
- [letterTemplateId]: { ...PDF_LETTER_TEMPLATE, id: letterTemplateId },
- [kuTemplateId]: { ...PDF_LETTER_TEMPLATE, id: kuTemplateId },
- [sqTemplateId]: { ...PDF_LETTER_TEMPLATE, id: sqTemplateId },
+ [letterTemplateId]: { ...AUTHORING_LETTER_TEMPLATE, id: letterTemplateId },
+ [kuTemplateId]: { ...AUTHORING_LETTER_TEMPLATE, id: kuTemplateId },
+ [sqTemplateId]: { ...AUTHORING_LETTER_TEMPLATE, id: sqTemplateId },
[largePrintTemplateId]: {
...LARGE_PRINT_LETTER_TEMPLATE,
id: largePrintTemplateId,
templateStatus: 'SUBMITTED',
},
- [authoringLetterTemplateId]: {
- ...AUTHORING_LETTER_TEMPLATE,
- id: authoringLetterTemplateId,
- templateStatus: 'PROOF_APPROVED',
- },
[bslTemplateId]: {
...BSL_LETTER_TEMPLATE,
id: bslTemplateId,
@@ -320,7 +313,7 @@ describe('Review and move to production page', () => {
).toBeInTheDocument();
});
- it('renders PDF letter template as link', async () => {
+ it('renders letter templates with a link', async () => {
const routingConfig = createRoutingConfig({
cascade: [
{
@@ -343,37 +336,7 @@ describe('Review and move to production page', () => {
expect(link).toHaveTextContent('Preview template (opens in a new tab)');
expect(link).toHaveAttribute(
'href',
- `/preview-letter-template/${letterTemplateId}`
- );
- expect(link).toHaveAttribute('target', '_blank');
- });
-
- it('renders AUTHORING letter template as link', async () => {
- const routingConfig = createRoutingConfig({
- cascade: [
- {
- channel: 'LETTER',
- channelType: 'primary',
- defaultTemplateId: authoringLetterTemplateId,
- cascadeGroups: ['standard'],
- },
- ],
- });
-
- await renderPage(routingConfig);
-
- const block = screen.getByTestId('message-plan-block-LETTER');
- const templateName = within(block).getByTestId('template-name');
-
- expect(templateName).toHaveTextContent(
- templates[authoringLetterTemplateId].name
- );
-
- const link = within(block).getByRole('link');
- expect(link).toHaveTextContent('Preview template (opens in a new tab)');
- expect(link).toHaveAttribute(
- 'href',
- `/message-plans/review-and-move-to-production/${routingConfig.id}/preview-template/${authoringLetterTemplateId}`
+ `/message-plans/review-and-move-to-production/${routingConfig.id}/preview-template/${letterTemplateId}`
);
expect(link).toHaveAttribute('target', '_blank');
});
@@ -501,7 +464,6 @@ describe('Review and move to production page', () => {
conditionalTemplates: [
{ templateId: kuTemplateId, language: 'ku' },
{ templateId: sqTemplateId, language: 'sq' },
- { templateId: authoringLetterTemplateId, accessibleFormat: 'x1' },
{ templateId: largePrintTemplateId, accessibleFormat: 'x1' },
{ templateId: bslTemplateId, accessibleFormat: 'q4' },
],
diff --git a/frontend/src/__tests__/app/message-plans/review-and-move-to-production/preview-template/page.test.tsx b/frontend/src/__tests__/app/message-plans/review-and-move-to-production/preview-template/page.test.tsx
index ba10c5993..b2efe15e2 100644
--- a/frontend/src/__tests__/app/message-plans/review-and-move-to-production/preview-template/page.test.tsx
+++ b/frontend/src/__tests__/app/message-plans/review-and-move-to-production/preview-template/page.test.tsx
@@ -5,7 +5,6 @@ import PreviewLetterTemplateFromReviewAndMoveToProduction, {
generateMetadata,
} from '@app/message-plans/review-and-move-to-production/[routingConfigId]/preview-template/[templateId]/page';
import { SummaryLetterFromMessagePlan } from '@molecules/SummaryLetterFromMessagePlan/SummaryLetterFromMessagePlan';
-import { validateAuthoringLetterTemplate } from 'nhs-notify-web-template-management-utils';
jest.mock(
'@molecules/SummaryLetterFromMessagePlan/SummaryLetterFromMessagePlan'
@@ -23,12 +22,7 @@ describe('PreviewLetterTemplateFromReviewAndMoveToProduction page', () => {
const page =
await PreviewLetterTemplateFromReviewAndMoveToProduction(props);
- expect(page).toEqual(
-
- );
+ expect(page).toEqual( );
});
it('should have the correct page title', async () => {
diff --git a/frontend/src/__tests__/components/forms/ChooseChannelTemplate/ChooseChannelTemplate.test.tsx b/frontend/src/__tests__/components/forms/ChooseChannelTemplate/ChooseChannelTemplate.test.tsx
index c6ceaa8e6..d82a7bbb0 100644
--- a/frontend/src/__tests__/components/forms/ChooseChannelTemplate/ChooseChannelTemplate.test.tsx
+++ b/frontend/src/__tests__/components/forms/ChooseChannelTemplate/ChooseChannelTemplate.test.tsx
@@ -1,9 +1,9 @@
import { ChooseChannelTemplate } from '@forms/ChooseChannelTemplate';
import { fireEvent, render, screen, within } from '@testing-library/react';
import {
+ AUTHORING_LETTER_TEMPLATE,
EMAIL_TEMPLATE,
LARGE_PRINT_LETTER_TEMPLATE,
- PDF_LETTER_TEMPLATE,
NHS_APP_TEMPLATE,
ROUTING_CONFIG,
SMS_TEMPLATE,
@@ -97,7 +97,7 @@ const propsByChannel = {
LETTER: {
pageHeading: 'Choose a letter template',
cascadeIndex: 3,
- templateList: [PDF_LETTER_TEMPLATE],
+ templateList: [AUTHORING_LETTER_TEMPLATE],
},
LARGE_PRINT_LETTER: {
pageHeading: 'Choose a large print letter template',
diff --git a/frontend/src/__tests__/components/forms/ChooseChannelTemplate/__snapshots__/ChooseChannelTemplate.test.tsx.snap b/frontend/src/__tests__/components/forms/ChooseChannelTemplate/__snapshots__/ChooseChannelTemplate.test.tsx.snap
index c627c8974..bfeebca33 100644
--- a/frontend/src/__tests__/components/forms/ChooseChannelTemplate/__snapshots__/ChooseChannelTemplate.test.tsx.snap
+++ b/frontend/src/__tests__/components/forms/ChooseChannelTemplate/__snapshots__/ChooseChannelTemplate.test.tsx.snap
@@ -1808,7 +1808,7 @@ exports[`ChooseChannelTemplate renders letter form 1`] = `
- letter template name
+ authoring letter template name
@@ -1898,19 +1898,19 @@ exports[`ChooseChannelTemplate renders letter form 1`] = `
class="nhsuk-radios__item"
>
@@ -1918,7 +1918,7 @@ exports[`ChooseChannelTemplate renders letter form 1`] = `
Name
- letter template name
+ authoring letter template name
Preview
diff --git a/frontend/src/__tests__/components/molecules/MessagePlanCascadePreview.test.tsx b/frontend/src/__tests__/components/molecules/MessagePlanCascadePreview.test.tsx
index 0c14fb810..70a43f288 100644
--- a/frontend/src/__tests__/components/molecules/MessagePlanCascadePreview.test.tsx
+++ b/frontend/src/__tests__/components/molecules/MessagePlanCascadePreview.test.tsx
@@ -4,17 +4,22 @@ import {
AUTHORING_LETTER_TEMPLATE,
EMAIL_TEMPLATE,
NHS_APP_TEMPLATE,
- PDF_LETTER_TEMPLATE,
ROUTING_CONFIG,
SMS_TEMPLATE,
} from '@testhelpers/helpers';
+import { AuthoringLetterTemplate } from 'nhs-notify-web-template-management-utils';
+
+const APPROVED_LETTER: AuthoringLetterTemplate = {
+ ...AUTHORING_LETTER_TEMPLATE,
+ templateStatus: 'PROOF_APPROVED',
+};
describe('MessagePlanCascadePreview', () => {
const templates = {
[NHS_APP_TEMPLATE.id]: NHS_APP_TEMPLATE,
[EMAIL_TEMPLATE.id]: EMAIL_TEMPLATE,
[SMS_TEMPLATE.id]: SMS_TEMPLATE,
- [PDF_LETTER_TEMPLATE.id]: PDF_LETTER_TEMPLATE,
+ [APPROVED_LETTER.id]: APPROVED_LETTER,
};
it('renders cascade preview with all channels', () => {
@@ -22,6 +27,7 @@ describe('MessagePlanCascadePreview', () => {
);
@@ -37,6 +43,7 @@ describe('MessagePlanCascadePreview', () => {
);
@@ -45,7 +52,7 @@ describe('MessagePlanCascadePreview', () => {
expect(templateNames[0]).toHaveTextContent(NHS_APP_TEMPLATE.name);
expect(templateNames[1]).toHaveTextContent(EMAIL_TEMPLATE.name);
expect(templateNames[2]).toHaveTextContent(SMS_TEMPLATE.name);
- expect(templateNames[3]).toHaveTextContent(PDF_LETTER_TEMPLATE.name);
+ expect(templateNames[3]).toHaveTextContent(AUTHORING_LETTER_TEMPLATE.name);
});
it('renders open/close all previews button when non-letter channels present', () => {
@@ -53,6 +60,7 @@ describe('MessagePlanCascadePreview', () => {
);
@@ -71,7 +79,7 @@ describe('MessagePlanCascadePreview', () => {
cascadeGroups: ['standard' as const],
channel: 'LETTER' as const,
channelType: 'primary' as const,
- defaultTemplateId: PDF_LETTER_TEMPLATE.id,
+ defaultTemplateId: AUTHORING_LETTER_TEMPLATE.id,
},
],
};
@@ -80,6 +88,7 @@ describe('MessagePlanCascadePreview', () => {
);
@@ -93,6 +102,7 @@ describe('MessagePlanCascadePreview', () => {
);
@@ -124,6 +134,7 @@ describe('MessagePlanCascadePreview', () => {
);
@@ -132,11 +143,12 @@ describe('MessagePlanCascadePreview', () => {
).not.toBeInTheDocument();
});
- it('renders letter template as link', () => {
+ it('renders letter template with link using letterPreviewHrefBase prop', () => {
render(
);
@@ -144,52 +156,18 @@ describe('MessagePlanCascadePreview', () => {
const link = letterBlock.querySelector('a');
expect(link).toHaveAttribute(
'href',
- `/preview-letter-template/${PDF_LETTER_TEMPLATE.id}`
+ `/base-url/preview-template/${AUTHORING_LETTER_TEMPLATE.id}`
);
expect(link).toHaveAttribute('target', '_blank');
expect(link).toHaveTextContent('Preview template (opens in a new tab)');
});
- it('renders submitted letter template with submitted link', () => {
- const submittedTemplate = {
- ...PDF_LETTER_TEMPLATE,
- id: 'submitted-letter-id',
- templateStatus: 'SUBMITTED' as const,
- };
- const templatesWithSubmitted = {
- ...templates,
- [submittedTemplate.id]: submittedTemplate,
- };
- const routingConfigWithSubmitted = {
- ...ROUTING_CONFIG,
- cascade: ROUTING_CONFIG.cascade.map((item) =>
- item.channel === 'LETTER'
- ? { ...item, defaultTemplateId: submittedTemplate.id }
- : item
- ),
- };
-
- render(
-
- );
-
- const letterBlock = screen.getByTestId('message-plan-block-LETTER');
- const link = letterBlock.querySelector('a');
- expect(link).toHaveAttribute(
- 'href',
- `/preview-submitted-letter-template/${submittedTemplate.id}`
- );
- expect(link).toHaveAttribute('target', '_blank');
- });
-
it('renders non-letter templates with preview details', () => {
render(
);
@@ -202,13 +180,14 @@ describe('MessagePlanCascadePreview', () => {
[NHS_APP_TEMPLATE.id]: NHS_APP_TEMPLATE,
// EMAIL_TEMPLATE is missing
[SMS_TEMPLATE.id]: SMS_TEMPLATE,
- [PDF_LETTER_TEMPLATE.id]: PDF_LETTER_TEMPLATE,
+ [AUTHORING_LETTER_TEMPLATE.id]: AUTHORING_LETTER_TEMPLATE,
};
render(
);
@@ -220,60 +199,12 @@ describe('MessagePlanCascadePreview', () => {
expect(screen.getByTestId('message-plan-block-LETTER')).toBeInTheDocument();
});
- it('renders authoring letter template with letterPreviewHrefBase link', () => {
- const authoringTemplates = {
- ...templates,
- [AUTHORING_LETTER_TEMPLATE.id]: AUTHORING_LETTER_TEMPLATE,
- };
- const routingConfigWithAuthoring = {
- ...ROUTING_CONFIG,
- cascade: ROUTING_CONFIG.cascade.map((item) =>
- item.channel === 'LETTER'
- ? { ...item, defaultTemplateId: AUTHORING_LETTER_TEMPLATE.id }
- : item
- ),
- };
-
- render(
-
- );
-
- const letterBlock = screen.getByTestId('message-plan-block-LETTER');
- const link = letterBlock.querySelector('a');
- expect(link).toHaveAttribute(
- 'href',
- `/message-plans/review-and-move-to-production/routing-config-id/preview-template/${AUTHORING_LETTER_TEMPLATE.id}`
- );
- expect(link).toHaveAttribute('target', '_blank');
- });
-
- it('renders PDF letter template with standard link even when letterPreviewHrefBase is provided', () => {
- render(
-
- );
-
- const letterBlock = screen.getByTestId('message-plan-block-LETTER');
- const link = letterBlock.querySelector('a');
- expect(link).toHaveAttribute(
- 'href',
- `/preview-letter-template/${PDF_LETTER_TEMPLATE.id}`
- );
- expect(link).toHaveAttribute('target', '_blank');
- });
-
it('matches snapshot', () => {
const { asFragment } = render(
);
diff --git a/frontend/src/__tests__/components/molecules/SummaryChooseLetter.test.tsx b/frontend/src/__tests__/components/molecules/SummaryChooseLetter.test.tsx
index 002b712a8..8bec9e9c0 100644
--- a/frontend/src/__tests__/components/molecules/SummaryChooseLetter.test.tsx
+++ b/frontend/src/__tests__/components/molecules/SummaryChooseLetter.test.tsx
@@ -1,7 +1,6 @@
import { SummaryChooseLetter } from '@molecules/SummaryChooseLetter/SummaryChooseLetter';
import {
AUTHORING_LETTER_TEMPLATE,
- PDF_LETTER_TEMPLATE,
makeLetterVariant,
ROUTING_CONFIG,
} from '@testhelpers/helpers';
@@ -71,7 +70,7 @@ describe('SummaryChooseLetter', () => {
it('should redirect to invalid-template when template fails validation', async () => {
getTemplateMock.mockResolvedValueOnce({
- ...PDF_LETTER_TEMPLATE,
+ ...AUTHORING_LETTER_TEMPLATE,
templateType: 'EMAIL',
} as unknown as TemplateDto);
@@ -80,28 +79,7 @@ describe('SummaryChooseLetter', () => {
expect(redirectMock).toHaveBeenCalledWith('/invalid-template', 'replace');
});
- it('renders a PDF letter template preview', async () => {
- getTemplateMock.mockResolvedValueOnce({
- ...PDF_LETTER_TEMPLATE,
- templateStatus: 'SUBMITTED',
- });
-
- const page = await SummaryChooseLetter({
- ...defaultProps,
- params: Promise.resolve({
- routingConfigId: ROUTING_CONFIG.id,
- templateId: PDF_LETTER_TEMPLATE.id,
- }),
- });
-
- const container = render(page);
-
- expect(getTemplateMock).toHaveBeenCalledWith(PDF_LETTER_TEMPLATE.id);
- expect(getLetterVariantByIdMock).not.toHaveBeenCalled();
- expect(container.asFragment()).toMatchSnapshot();
- });
-
- it('renders an authoring letter template preview', async () => {
+ it('renders a letter template preview', async () => {
const letterVariant = makeLetterVariant();
getTemplateMock.mockResolvedValueOnce({
diff --git a/frontend/src/__tests__/components/molecules/__snapshots__/MessagePlanCascadePreview.test.tsx.snap b/frontend/src/__tests__/components/molecules/__snapshots__/MessagePlanCascadePreview.test.tsx.snap
index e3d1d838a..546575a07 100644
--- a/frontend/src/__tests__/components/molecules/__snapshots__/MessagePlanCascadePreview.test.tsx.snap
+++ b/frontend/src/__tests__/components/molecules/__snapshots__/MessagePlanCascadePreview.test.tsx.snap
@@ -513,10 +513,10 @@ exports[`MessagePlanCascadePreview matches snapshot 1`] = `
- letter template name
+ authoring letter template name
diff --git a/frontend/src/__tests__/components/molecules/__snapshots__/SummaryChooseLetter.test.tsx.snap b/frontend/src/__tests__/components/molecules/__snapshots__/SummaryChooseLetter.test.tsx.snap
index 1df7f8661..bccd4f747 100644
--- a/frontend/src/__tests__/components/molecules/__snapshots__/SummaryChooseLetter.test.tsx.snap
+++ b/frontend/src/__tests__/components/molecules/__snapshots__/SummaryChooseLetter.test.tsx.snap
@@ -1,130 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`SummaryChooseLetter renders a PDF letter template preview 1`] = `
-
-
-
- Go back
-
-
-
-
-
-
- Template
-
-
- letter template name
-
-
-
-
-
-
- Template ID
-
-
- letter-template-id
-
-
-
-
- Template type
-
-
- Standard letter
-
-
-
-
- Template file
-
-
-
-
-
-
-
- template.pdf
-
-
-
-
-
-
-
- Go back
-
-
-
-
-
-
-`;
-
-exports[`SummaryChooseLetter renders an authoring letter template preview 1`] = `
+exports[`SummaryChooseLetter renders a letter template preview 1`] = `
{
const PreviewLetterTemplateFromPreviewMessagePlan = async (
props: MessagePlanAndTemplatePageProps
-) => (
-
-);
+) =>
;
export default PreviewLetterTemplateFromPreviewMessagePlan;
diff --git a/frontend/src/app/message-plans/review-and-move-to-production/[routingConfigId]/preview-template/[templateId]/page.tsx b/frontend/src/app/message-plans/review-and-move-to-production/[routingConfigId]/preview-template/[templateId]/page.tsx
index b3723ca56..934bdb8b0 100644
--- a/frontend/src/app/message-plans/review-and-move-to-production/[routingConfigId]/preview-template/[templateId]/page.tsx
+++ b/frontend/src/app/message-plans/review-and-move-to-production/[routingConfigId]/preview-template/[templateId]/page.tsx
@@ -1,7 +1,4 @@
-import {
- MessagePlanAndTemplatePageProps,
- validateAuthoringLetterTemplate,
-} from 'nhs-notify-web-template-management-utils';
+import { MessagePlanAndTemplatePageProps } from 'nhs-notify-web-template-management-utils';
import { Metadata } from 'next';
import content from '@content/content';
import { SummaryLetterFromMessagePlan } from '@molecules/SummaryLetterFromMessagePlan/SummaryLetterFromMessagePlan';
@@ -16,11 +13,6 @@ export async function generateMetadata(): Promise
{
const PreviewLetterTemplateFromReviewAndMoveToProduction = async (
props: MessagePlanAndTemplatePageProps
-) => (
-
-);
+) => ;
export default PreviewLetterTemplateFromReviewAndMoveToProduction;
diff --git a/frontend/src/components/molecules/MessagePlanCascadePreview/MessagePlanCascadePreview.tsx b/frontend/src/components/molecules/MessagePlanCascadePreview/MessagePlanCascadePreview.tsx
index ed29a6498..c620324f1 100644
--- a/frontend/src/components/molecules/MessagePlanCascadePreview/MessagePlanCascadePreview.tsx
+++ b/frontend/src/components/molecules/MessagePlanCascadePreview/MessagePlanCascadePreview.tsx
@@ -43,25 +43,13 @@ function getLetterTemplatePreviewHref(
template: TemplateDto,
letterPreviewHrefBase?: string
): string {
- if (
- letterPreviewHrefBase &&
- 'letterVersion' in template &&
- template.letterVersion === 'AUTHORING'
- ) {
- return `${letterPreviewHrefBase}/preview-template/${template.id}`;
- }
-
- const linkTemplate =
- template.templateStatus === 'SUBMITTED'
- ? pageContent.letterTemplateLinks.previewSubmitted
- : pageContent.letterTemplateLinks.preview;
- return interpolate(linkTemplate, { id: template.id });
+ return `${letterPreviewHrefBase}/preview-template/${template.id}`;
}
export type MessagePlanCascadePreviewProps = {
messagePlan: RoutingConfig;
templates: MessagePlanTemplates;
- letterPreviewHrefBase?: string;
+ letterPreviewHrefBase: string;
};
export function MessagePlanCascadePreview({
diff --git a/frontend/src/components/molecules/SummaryChooseLetter/SummaryChooseLetter.tsx b/frontend/src/components/molecules/SummaryChooseLetter/SummaryChooseLetter.tsx
index f918c60f7..de07b0666 100644
--- a/frontend/src/components/molecules/SummaryChooseLetter/SummaryChooseLetter.tsx
+++ b/frontend/src/components/molecules/SummaryChooseLetter/SummaryChooseLetter.tsx
@@ -1,5 +1,4 @@
import {
- AuthoringLetterTemplate,
LetterTemplate,
MessagePlanAndTemplatePageProps,
} from 'nhs-notify-web-template-management-utils';
@@ -18,7 +17,7 @@ type SummaryChooseLetterProps = MessagePlanAndTemplatePageProps & {
export const SummaryChooseLetter = async (props: SummaryChooseLetterProps) => {
const { templateId, routingConfigId } = await props.params;
- const { validateTemplate, redirectUrlOnLockNumberFailure } = props;
+ const { redirectUrlOnLockNumberFailure } = props;
const searchParams = await props.searchParams;
const lockNumberResult = $LockNumber.safeParse(searchParams?.lockNumber);
@@ -31,18 +30,19 @@ export const SummaryChooseLetter = async (props: SummaryChooseLetterProps) => {
const template = await getTemplate(templateId);
- const validatedTemplate = validateTemplate(template);
+ const validatedTemplate = props.validateTemplate(template);
- if (!validatedTemplate) {
+ if (
+ !validatedTemplate ||
+ !('letterVariantId' in validatedTemplate) ||
+ !validatedTemplate.letterVariantId
+ ) {
return redirect('/invalid-template', RedirectType.replace);
}
- const letterVariantId = (validatedTemplate as AuthoringLetterTemplate)
- .letterVariantId;
-
- const letterVariant = letterVariantId
- ? await getLetterVariantById(letterVariantId)
- : undefined;
+ const letterVariant = await getLetterVariantById(
+ validatedTemplate.letterVariantId
+ );
return (
diff --git a/frontend/src/components/molecules/SummaryLetterFromMessagePlan/SummaryLetterFromMessagePlan.tsx b/frontend/src/components/molecules/SummaryLetterFromMessagePlan/SummaryLetterFromMessagePlan.tsx
index c11646fbe..ddd0c8c97 100644
--- a/frontend/src/components/molecules/SummaryLetterFromMessagePlan/SummaryLetterFromMessagePlan.tsx
+++ b/frontend/src/components/molecules/SummaryLetterFromMessagePlan/SummaryLetterFromMessagePlan.tsx
@@ -1,39 +1,29 @@
import {
- AuthoringLetterTemplate,
- LetterTemplate,
MessagePlanAndTemplatePageProps,
+ validateAuthoringLetterTemplate,
} from 'nhs-notify-web-template-management-utils';
-import type { TemplateDto } from 'nhs-notify-web-template-management-types';
import { getLetterVariantById, getTemplate } from '@utils/form-actions';
import { redirect, RedirectType } from 'next/navigation';
import { PreviewTemplateFromMessagePlan } from '@molecules/PreviewTemplateFromMessagePlan/PreviewTemplateFromMessagePlan';
import PreviewTemplateDetailsLetter from '@molecules/PreviewTemplateDetails/PreviewTemplateDetailsLetter';
import { NHSNotifyContainer } from '@layouts/container/container';
-type SummaryLetterFromMessagePlanProps = MessagePlanAndTemplatePageProps & {
- validateTemplate: (template?: TemplateDto) => LetterTemplate | undefined;
-};
-
export const SummaryLetterFromMessagePlan = async (
- props: SummaryLetterFromMessagePlanProps
+ props: MessagePlanAndTemplatePageProps
) => {
const { templateId, routingConfigId } = await props.params;
- const { validateTemplate } = props;
const template = await getTemplate(templateId);
- const validatedTemplate = validateTemplate(template);
+ const validatedTemplate = validateAuthoringLetterTemplate(template);
- if (!validatedTemplate) {
+ if (!validatedTemplate || !validatedTemplate.letterVariantId) {
return redirect('/invalid-template', RedirectType.replace);
}
- const letterVariantId = (validatedTemplate as AuthoringLetterTemplate)
- .letterVariantId;
-
- const letterVariant = letterVariantId
- ? await getLetterVariantById(letterVariantId)
- : undefined;
+ const letterVariant = await getLetterVariantById(
+ validatedTemplate.letterVariantId
+ );
return (
diff --git a/tests/test-team/template-mgmt-e2e-tests/routing.e2e.spec.ts b/tests/test-team/template-mgmt-e2e-tests/routing.e2e.spec.ts
index f92681e12..ad94767fd 100644
--- a/tests/test-team/template-mgmt-e2e-tests/routing.e2e.spec.ts
+++ b/tests/test-team/template-mgmt-e2e-tests/routing.e2e.spec.ts
@@ -27,11 +27,14 @@ import { TemplateMgmtMessageTemplatesPage } from '../pages/template-mgmt-message
import { RoutingChooseTemplateForMessagePlanBasePage } from '../pages/routing/choose-template-base-page';
import type { Template } from '../helpers/types';
import { loginAsUser } from 'helpers/auth/login-as-user';
-import type { Channel } from 'nhs-notify-web-template-management-types';
+import type {
+ Channel,
+ LetterVariant,
+} from 'nhs-notify-web-template-management-types';
const templateStorageHelper = new TemplateStorageHelper();
-function createTemplates(user: TestUser) {
+function createTemplates(user: TestUser, letterVariant: LetterVariant) {
const templateIds = {
NHSAPP: randomUUID(),
EMAIL: randomUUID(),
@@ -70,6 +73,7 @@ function createTemplates(user: TestUser) {
{
shortFormRender: { status: 'RENDERED' },
longFormRender: { status: 'RENDERED' },
+ letterVariantId: letterVariant.id,
}
),
LARGE_PRINT_LETTER: TemplateFactory.createAuthoringLetterTemplate(
@@ -81,6 +85,7 @@ function createTemplates(user: TestUser) {
letterType: 'x1',
shortFormRender: { status: 'RENDERED' },
longFormRender: { status: 'RENDERED' },
+ letterVariantId: letterVariant.id,
}
),
BSL_LETTER: TemplateFactory.createAuthoringLetterTemplate(
@@ -92,6 +97,7 @@ function createTemplates(user: TestUser) {
letterType: 'q4',
shortFormRender: { status: 'RENDERED' },
longFormRender: { status: 'RENDERED' },
+ letterVariantId: letterVariant.id,
}
),
ARABIC_LETTER: TemplateFactory.createAuthoringLetterTemplate(
@@ -103,6 +109,7 @@ function createTemplates(user: TestUser) {
language: 'ar',
shortFormRender: { status: 'RENDERED' },
longFormRender: { status: 'RENDERED' },
+ letterVariantId: letterVariant.id,
}
),
POLISH_LETTER: TemplateFactory.createAuthoringLetterTemplate(
@@ -114,6 +121,7 @@ function createTemplates(user: TestUser) {
language: 'pl',
shortFormRender: { status: 'RENDERED' },
longFormRender: { status: 'RENDERED' },
+ letterVariantId: letterVariant.id,
}
),
};
@@ -178,7 +186,10 @@ test.describe('Routing', () => {
user = await context.auth.getTestUser(
testUsers.UserLetterAuthoringEnabled.userId
);
- templates = createTemplates(user);
+ const [globalLetterVariant] =
+ await context.letterVariants.getGlobalLetterVariants();
+
+ templates = createTemplates(user, globalLetterVariant);
await templateStorageHelper.seedTemplateData(Object.values(templates));
});
diff --git a/tests/test-team/template-mgmt-routing-component-tests/letter/preview-british-sign-language-letter-template.routing-component.spec.ts b/tests/test-team/template-mgmt-routing-component-tests/letter/preview-british-sign-language-letter-template.routing-component.spec.ts
index 39ea4d9e9..5dfdc443d 100644
--- a/tests/test-team/template-mgmt-routing-component-tests/letter/preview-british-sign-language-letter-template.routing-component.spec.ts
+++ b/tests/test-team/template-mgmt-routing-component-tests/letter/preview-british-sign-language-letter-template.routing-component.spec.ts
@@ -15,6 +15,7 @@ import { RoutingPreviewBritishSignLanguageLetterTemplatePage } from 'pages/routi
import { RoutingConfigFactory } from 'helpers/factories/routing-config-factory';
import { RoutingConfigStorageHelper } from 'helpers/db/routing-config-storage-helper';
import { getTestContext } from 'helpers/context/context';
+import { LetterVariant } from 'nhs-notify-web-template-management-types';
const routingConfigStorageHelper = new RoutingConfigStorageHelper();
const templateStorageHelper = new TemplateStorageHelper();
@@ -31,7 +32,7 @@ function createMessagePlans(user: TestUser) {
};
}
-function createTemplates(user: TestUser) {
+function createTemplates(user: TestUser, letterVariant: LetterVariant) {
return {
EMAIL: TemplateFactory.createEmailTemplate(
randomUUID(),
@@ -41,7 +42,13 @@ function createTemplates(user: TestUser) {
STANDARD_LETTER: TemplateFactory.createAuthoringLetterTemplate(
randomUUID(),
user,
- 'Standard letter template name'
+ 'Standard letter template name',
+ 'SUBMITTED',
+ {
+ shortFormRender: { status: 'RENDERED' },
+ longFormRender: { status: 'RENDERED' },
+ letterVariantId: letterVariant.id,
+ }
),
BSL_LETTER: TemplateFactory.createAuthoringLetterTemplate(
randomUUID(),
@@ -52,6 +59,7 @@ function createTemplates(user: TestUser) {
letterType: 'q4',
shortFormRender: { status: 'RENDERED' },
longFormRender: { status: 'RENDERED' },
+ letterVariantId: letterVariant.id,
}
),
};
@@ -65,8 +73,11 @@ test.describe('Routing - Preview British Sign Language letter template page', ()
const context = getTestContext();
const user = await context.auth.getTestUser(testUsers.User1.userId);
+ const [globalLetterVariant] =
+ await context.letterVariants.getGlobalLetterVariants();
+
messagePlans = createMessagePlans(user);
- templates = createTemplates(user);
+ templates = createTemplates(user, globalLetterVariant);
await routingConfigStorageHelper.seed(Object.values(messagePlans));
await templateStorageHelper.seedTemplateData(Object.values(templates));
@@ -153,12 +164,6 @@ test.describe('Routing - Preview British Sign Language letter template page', ()
await expect(previewBSLLetterTemplatePage.summaryList).toBeVisible();
- expect(templates.BSL_LETTER.campaignId).toBeTruthy();
-
- await expect(previewBSLLetterTemplatePage.campaignId).toContainText(
- templates.BSL_LETTER.campaignId!
- );
-
await expect(
previewBSLLetterTemplatePage.letterPreviewHeading
).toBeVisible();
diff --git a/tests/test-team/template-mgmt-routing-component-tests/letter/preview-large-print-letter-template.routing-component.spec.ts b/tests/test-team/template-mgmt-routing-component-tests/letter/preview-large-print-letter-template.routing-component.spec.ts
index c3ef137db..e927984e4 100644
--- a/tests/test-team/template-mgmt-routing-component-tests/letter/preview-large-print-letter-template.routing-component.spec.ts
+++ b/tests/test-team/template-mgmt-routing-component-tests/letter/preview-large-print-letter-template.routing-component.spec.ts
@@ -15,6 +15,7 @@ import { RoutingPreviewLargePrintLetterTemplatePage } from 'pages/routing/letter
import { RoutingConfigFactory } from 'helpers/factories/routing-config-factory';
import { RoutingConfigStorageHelper } from 'helpers/db/routing-config-storage-helper';
import { getTestContext } from 'helpers/context/context';
+import { LetterVariant } from 'nhs-notify-web-template-management-types';
const routingConfigStorageHelper = new RoutingConfigStorageHelper();
const templateStorageHelper = new TemplateStorageHelper();
@@ -31,27 +32,25 @@ function createMessagePlans(user: TestUser) {
};
}
-function createTemplates(user: TestUser) {
+function createTemplates(user: TestUser, letterVariant: LetterVariant) {
return {
EMAIL: TemplateFactory.createEmailTemplate(
randomUUID(),
user,
'Email template name'
),
- STANDARD_LETTER: TemplateFactory.uploadPdfLetterTemplate(
+ STANDARD_LETTER: TemplateFactory.createAuthoringLetterTemplate(
randomUUID(),
user,
- 'Standard letter template name'
- ),
- LARGE_PRINT_LETTER: TemplateFactory.uploadPdfLetterTemplate(
- randomUUID(),
- user,
- 'Large print letter template name',
+ 'Standard letter template name',
'SUBMITTED',
- 'PASSED',
- { letterType: 'x1' }
+ {
+ shortFormRender: { status: 'RENDERED' },
+ longFormRender: { status: 'RENDERED' },
+ letterVariantId: letterVariant.id,
+ }
),
- AUTHORING_LARGE_PRINT_LETTER: TemplateFactory.createAuthoringLetterTemplate(
+ LARGE_PRINT_LETTER: TemplateFactory.createAuthoringLetterTemplate(
randomUUID(),
user,
'Authoring large print letter template name',
@@ -60,6 +59,7 @@ function createTemplates(user: TestUser) {
letterType: 'x1',
shortFormRender: { status: 'RENDERED' },
longFormRender: { status: 'RENDERED' },
+ letterVariantId: letterVariant.id,
}
),
};
@@ -73,8 +73,11 @@ test.describe('Routing - Preview large print letter template page', () => {
const context = getTestContext();
const user = await context.auth.getTestUser(testUsers.User1.userId);
+ const [globalLetterVariant] =
+ await context.letterVariants.getGlobalLetterVariants();
+
messagePlans = createMessagePlans(user);
- templates = createTemplates(user);
+ templates = createTemplates(user, globalLetterVariant);
await routingConfigStorageHelper.seed(Object.values(messagePlans));
await templateStorageHelper.seedTemplateData(Object.values(templates));
@@ -159,58 +162,6 @@ test.describe('Routing - Preview large print letter template page', () => {
await expect(previewLargePrintLetterTemplatePage.summaryList).toBeVisible();
- expect(templates.LARGE_PRINT_LETTER.campaignId).toBeTruthy();
-
- await expect(previewLargePrintLetterTemplatePage.campaignId).toContainText(
- templates.LARGE_PRINT_LETTER.campaignId!
- );
-
- await expect(
- page.getByText(templates.LARGE_PRINT_LETTER.files!.pdfTemplate!.fileName)
- ).toBeVisible();
-
- await expect(
- page.getByText(templates.LARGE_PRINT_LETTER.files!.testDataCsv!.fileName)
- ).toBeVisible();
- });
-
- test('loads the AUTHORING large print letter template', async ({
- page,
- baseURL,
- }) => {
- const previewLargePrintLetterTemplatePage =
- new RoutingPreviewLargePrintLetterTemplatePage(page);
- await previewLargePrintLetterTemplatePage
- .setPathParam('messagePlanId', messagePlans.LETTER_ROUTING_CONFIG.id)
- .setPathParam('templateId', templates.AUTHORING_LARGE_PRINT_LETTER.id)
- .setSearchParam('lockNumber', '0')
- .loadPage();
-
- await expect(page).toHaveURL(
- `${baseURL}/templates/message-plans/choose-large-print-letter-template/${messagePlans.LETTER_ROUTING_CONFIG.id}/preview-template/${templates.AUTHORING_LARGE_PRINT_LETTER.id}?lockNumber=0`
- );
-
- await expect(
- previewLargePrintLetterTemplatePage.templateCaption
- ).toContainText('Template');
-
- await expect(previewLargePrintLetterTemplatePage.pageHeading).toContainText(
- templates.AUTHORING_LARGE_PRINT_LETTER.name
- );
-
- await expect(previewLargePrintLetterTemplatePage.templateId).toBeVisible();
- await expect(previewLargePrintLetterTemplatePage.templateId).toContainText(
- templates.AUTHORING_LARGE_PRINT_LETTER.id
- );
-
- await expect(previewLargePrintLetterTemplatePage.summaryList).toBeVisible();
-
- expect(templates.AUTHORING_LARGE_PRINT_LETTER.campaignId).toBeTruthy();
-
- await expect(previewLargePrintLetterTemplatePage.campaignId).toContainText(
- templates.AUTHORING_LARGE_PRINT_LETTER.campaignId!
- );
-
await expect(
previewLargePrintLetterTemplatePage.letterPreviewHeading
).toBeVisible();
@@ -222,7 +173,7 @@ test.describe('Routing - Preview large print letter template page', () => {
previewLargePrintLetterTemplatePage.letterPreviewIframe
).toHaveAttribute(
'src',
- `/templates/files/${templates.AUTHORING_LARGE_PRINT_LETTER.clientId}/renders/${templates.AUTHORING_LARGE_PRINT_LETTER.id}/initial-render.pdf`
+ `/templates/files/${templates.LARGE_PRINT_LETTER.clientId}/renders/${templates.LARGE_PRINT_LETTER.id}/initial-render.pdf`
);
});
diff --git a/tests/test-team/template-mgmt-routing-component-tests/letter/preview-other-language-letter-template.routing-component.spec.ts b/tests/test-team/template-mgmt-routing-component-tests/letter/preview-other-language-letter-template.routing-component.spec.ts
index 89f58743c..67a6efba1 100644
--- a/tests/test-team/template-mgmt-routing-component-tests/letter/preview-other-language-letter-template.routing-component.spec.ts
+++ b/tests/test-team/template-mgmt-routing-component-tests/letter/preview-other-language-letter-template.routing-component.spec.ts
@@ -15,6 +15,7 @@ import { RoutingPreviewOtherLanguageLetterTemplatePage } from 'pages/routing/let
import { RoutingConfigFactory } from 'helpers/factories/routing-config-factory';
import { RoutingConfigStorageHelper } from 'helpers/db/routing-config-storage-helper';
import { getTestContext } from 'helpers/context/context';
+import { LetterVariant } from 'nhs-notify-web-template-management-types';
const routingConfigStorageHelper = new RoutingConfigStorageHelper();
const templateStorageHelper = new TemplateStorageHelper();
@@ -38,27 +39,25 @@ function createMessagePlans(user: TestUser) {
};
}
-function createTemplates(user: TestUser) {
+function createTemplates(user: TestUser, letterVariant: LetterVariant) {
return {
EMAIL: TemplateFactory.createEmailTemplate(
templateIds.EMAIL,
user,
'Email template name'
),
- STANDARD_LETTER: TemplateFactory.uploadPdfLetterTemplate(
+ STANDARD_LETTER: TemplateFactory.createAuthoringLetterTemplate(
templateIds.STANDARD_LETTER,
user,
- 'Standard letter template name'
- ),
- FRENCH_LETTER: TemplateFactory.uploadPdfLetterTemplate(
- templateIds.FRENCH_LETTER,
- user,
- 'French letter template name',
- 'SUBMITTED',
- 'PASSED',
- { language: 'fr' }
+ 'Standard letter template name',
+ 'PROOF_APPROVED',
+ {
+ shortFormRender: { status: 'RENDERED' },
+ longFormRender: { status: 'RENDERED' },
+ letterVariantId: letterVariant.id,
+ }
),
- AUTHORING_FRENCH_LETTER: TemplateFactory.createAuthoringLetterTemplate(
+ FRENCH_LETTER: TemplateFactory.createAuthoringLetterTemplate(
templateIds.AUTHORING_FRENCH_LETTER,
user,
'Authoring French letter template name',
@@ -67,6 +66,7 @@ function createTemplates(user: TestUser) {
language: 'fr',
shortFormRender: { status: 'RENDERED' },
longFormRender: { status: 'RENDERED' },
+ letterVariantId: letterVariant.id,
}
),
};
@@ -80,8 +80,11 @@ test.describe('Routing - Preview foreign language letter template page', () => {
const context = getTestContext();
const user = await context.auth.getTestUser(testUsers.User1.userId);
+ const [globalLetterVariant] =
+ await context.letterVariants.getGlobalLetterVariants();
+
messagePlans = createMessagePlans(user);
- templates = createTemplates(user);
+ templates = createTemplates(user, globalLetterVariant);
await routingConfigStorageHelper.seed(Object.values(messagePlans));
await templateStorageHelper.seedTemplateData(Object.values(templates));
@@ -178,63 +181,6 @@ test.describe('Routing - Preview foreign language letter template page', () => {
previewForeignLanguageLetterTemplatePage.summaryList
).toBeVisible();
- expect(templates.FRENCH_LETTER.campaignId).toBeTruthy();
-
- await expect(
- previewForeignLanguageLetterTemplatePage.campaignId
- ).toContainText(templates.FRENCH_LETTER.campaignId!);
-
- await expect(
- page.getByText(templates.FRENCH_LETTER.files!.pdfTemplate!.fileName)
- ).toBeVisible();
-
- await expect(
- page.getByText(templates.FRENCH_LETTER.files!.testDataCsv!.fileName)
- ).toBeVisible();
- });
-
- test('loads the AUTHORING foreign language letter template', async ({
- page,
- baseURL,
- }) => {
- const previewForeignLanguageLetterTemplatePage =
- new RoutingPreviewOtherLanguageLetterTemplatePage(page)
- .setPathParam('messagePlanId', messagePlans.LETTER_ROUTING_CONFIG.id)
- .setPathParam('templateId', templates.AUTHORING_FRENCH_LETTER.id)
- .setSearchParam('lockNumber', '0');
- await previewForeignLanguageLetterTemplatePage.loadPage();
- await expect(page).toHaveURL(
- `${baseURL}/templates/message-plans/choose-other-language-letter-template/${messagePlans.LETTER_ROUTING_CONFIG.id}/preview-template/${templates.AUTHORING_FRENCH_LETTER.id}?lockNumber=0`
- );
-
- await expect(
- previewForeignLanguageLetterTemplatePage.templateCaption
- ).toBeVisible();
- await expect(
- previewForeignLanguageLetterTemplatePage.templateCaption
- ).toContainText('Template');
-
- await expect(
- previewForeignLanguageLetterTemplatePage.pageHeading
- ).toContainText(templates.AUTHORING_FRENCH_LETTER.name);
-
- await expect(
- previewForeignLanguageLetterTemplatePage.templateId
- ).toBeVisible();
- await expect(
- previewForeignLanguageLetterTemplatePage.templateId
- ).toContainText(templates.AUTHORING_FRENCH_LETTER.id);
-
- await expect(
- previewForeignLanguageLetterTemplatePage.summaryList
- ).toBeVisible();
-
- expect(templates.AUTHORING_FRENCH_LETTER.campaignId).toBeTruthy();
-
- await expect(
- previewForeignLanguageLetterTemplatePage.campaignId
- ).toContainText(templates.AUTHORING_FRENCH_LETTER.campaignId!);
-
await expect(
previewForeignLanguageLetterTemplatePage.letterPreviewHeading
).toBeVisible();
@@ -246,7 +192,7 @@ test.describe('Routing - Preview foreign language letter template page', () => {
previewForeignLanguageLetterTemplatePage.letterPreviewIframe
).toHaveAttribute(
'src',
- `/templates/files/${templates.AUTHORING_FRENCH_LETTER.clientId}/renders/${templates.AUTHORING_FRENCH_LETTER.id}/initial-render.pdf`
+ `/templates/files/${templates.FRENCH_LETTER.clientId}/renders/${templates.FRENCH_LETTER.id}/initial-render.pdf`
);
});
diff --git a/tests/test-team/template-mgmt-routing-component-tests/letter/preview-standard-letter-template.routing-component.spec.ts b/tests/test-team/template-mgmt-routing-component-tests/letter/preview-standard-letter-template.routing-component.spec.ts
index cad9b66d9..7be56755a 100644
--- a/tests/test-team/template-mgmt-routing-component-tests/letter/preview-standard-letter-template.routing-component.spec.ts
+++ b/tests/test-team/template-mgmt-routing-component-tests/letter/preview-standard-letter-template.routing-component.spec.ts
@@ -15,6 +15,7 @@ import { RoutingPreviewStandardLetterTemplatePage } from 'pages/routing/letter/p
import { RoutingConfigFactory } from 'helpers/factories/routing-config-factory';
import { RoutingConfigStorageHelper } from 'helpers/db/routing-config-storage-helper';
import { getTestContext } from 'helpers/context/context';
+import { LetterVariant } from 'nhs-notify-web-template-management-types';
const routingConfigStorageHelper = new RoutingConfigStorageHelper();
const templateStorageHelper = new TemplateStorageHelper();
@@ -31,22 +32,23 @@ function createMessagePlans(user: TestUser) {
};
}
-function createTemplates(user: TestUser) {
+function createTemplates(user: TestUser, letterVariant: LetterVariant) {
return {
EMAIL: TemplateFactory.createEmailTemplate(
randomUUID(),
user,
'Email template name'
),
- LETTER: TemplateFactory.uploadPdfLetterTemplate(
+ LETTER: TemplateFactory.createAuthoringLetterTemplate(
randomUUID(),
user,
- 'Letter template name'
- ),
- AUTHORING_LETTER: TemplateFactory.createAuthoringLetterTemplate(
- randomUUID(),
- user,
- 'Authoring letter template name'
+ 'Letter template name',
+ 'PROOF_APPROVED',
+ {
+ shortFormRender: { status: 'RENDERED' },
+ longFormRender: { status: 'RENDERED' },
+ letterVariantId: letterVariant.id,
+ }
),
};
}
@@ -59,8 +61,11 @@ test.describe('Routing - Preview Letter template page', () => {
const context = getTestContext();
const user = await context.auth.getTestUser(testUsers.User1.userId);
+ const [globalLetterVariant] =
+ await context.letterVariants.getGlobalLetterVariants();
+
messagePlans = createMessagePlans(user);
- templates = createTemplates(user);
+ templates = createTemplates(user, globalLetterVariant);
await routingConfigStorageHelper.seed(Object.values(messagePlans));
await templateStorageHelper.seedTemplateData(Object.values(templates));
@@ -88,7 +93,7 @@ test.describe('Routing - Preview Letter template page', () => {
await assertAndClickBackLinkTop(props);
});
- test('loads the Letter template', async ({ page, baseURL }) => {
+ test('loads the letter template', async ({ page, baseURL }) => {
const previewLetterTemplatePage =
new RoutingPreviewStandardLetterTemplatePage(page)
.setPathParam('messagePlanId', messagePlans.LETTER_ROUTING_CONFIG.id)
@@ -111,41 +116,9 @@ test.describe('Routing - Preview Letter template page', () => {
templates.LETTER.campaignId!
);
- await expect(
- page.getByText(templates.LETTER.files!.pdfTemplate!.fileName)
- ).toBeVisible();
-
- await expect(
- page.getByText(templates.LETTER.files!.testDataCsv!.fileName)
- ).toBeVisible();
- });
-
- test('loads the AUTHORING letter template', async ({ page, baseURL }) => {
- const previewLetterTemplatePage =
- new RoutingPreviewStandardLetterTemplatePage(page)
- .setPathParam('messagePlanId', messagePlans.LETTER_ROUTING_CONFIG.id)
- .setPathParam('templateId', templates.AUTHORING_LETTER.id)
- .setSearchParam('lockNumber', '0');
-
- await previewLetterTemplatePage.loadPage();
-
- await expect(page).toHaveURL(
- `${baseURL}/templates/message-plans/choose-standard-english-letter-template/${messagePlans.LETTER_ROUTING_CONFIG.id}/preview-template/${templates.AUTHORING_LETTER.id}?lockNumber=0`
- );
-
- await expect(previewLetterTemplatePage.pageHeading).toContainText(
- templates.AUTHORING_LETTER.name
- );
-
- expect(templates.AUTHORING_LETTER.campaignId).toBeTruthy();
-
- await expect(previewLetterTemplatePage.campaignId).toContainText(
- templates.AUTHORING_LETTER.campaignId!
- );
-
await expect(previewLetterTemplatePage.templateId).toBeVisible();
await expect(previewLetterTemplatePage.templateId).toContainText(
- templates.AUTHORING_LETTER.id
+ templates.LETTER.id
);
await expect(previewLetterTemplatePage.summaryList).toBeVisible();
@@ -155,7 +128,7 @@ test.describe('Routing - Preview Letter template page', () => {
await expect(previewLetterTemplatePage.letterPreviewIframe).toHaveAttribute(
'src',
- `/templates/files/${templates.AUTHORING_LETTER.clientId}/renders/${templates.AUTHORING_LETTER.id}/initial-render.pdf`
+ `/templates/files/${templates.LETTER.clientId}/renders/${templates.LETTER.id}/initial-render.pdf`
);
});
diff --git a/tests/test-team/template-mgmt-routing-component-tests/preview-message-plan-preview-letter-template.routing-component.spec.ts b/tests/test-team/template-mgmt-routing-component-tests/preview-message-plan-preview-letter-template.routing-component.spec.ts
index 10afb0e90..60bef3bb0 100644
--- a/tests/test-team/template-mgmt-routing-component-tests/preview-message-plan-preview-letter-template.routing-component.spec.ts
+++ b/tests/test-team/template-mgmt-routing-component-tests/preview-message-plan-preview-letter-template.routing-component.spec.ts
@@ -13,6 +13,7 @@ import { RoutingPreviewMessagePlanPreviewLetterTemplatePage } from 'pages/routin
import { RoutingConfigFactory } from 'helpers/factories/routing-config-factory';
import { RoutingConfigStorageHelper } from 'helpers/db/routing-config-storage-helper';
import { getTestContext } from 'helpers/context/context';
+import { LetterVariant } from 'nhs-notify-web-template-management-types';
const routingConfigStorageHelper = new RoutingConfigStorageHelper();
const templateStorageHelper = new TemplateStorageHelper();
@@ -29,11 +30,10 @@ function createMessagePlans(user: TestUser) {
};
}
-function createTemplates(user: TestUser) {
+function createTemplates(user: TestUser, letterVariant: LetterVariant) {
const templateIds = {
EMAIL: randomUUID(),
LETTER: randomUUID(),
- PDF_LETTER: randomUUID(),
};
return {
@@ -45,12 +45,13 @@ function createTemplates(user: TestUser) {
LETTER: TemplateFactory.createAuthoringLetterTemplate(
templateIds.LETTER,
user,
- `Test Authoring Letter template - ${templateIds.LETTER}`
- ),
- PDF_LETTER: TemplateFactory.uploadPdfLetterTemplate(
- templateIds.PDF_LETTER,
- user,
- `Test PDF Letter template - ${templateIds.PDF_LETTER}`
+ `Test Authoring Letter template - ${templateIds.LETTER}`,
+ 'PROOF_APPROVED',
+ {
+ letterVariantId: letterVariant.id,
+ longFormRender: { status: 'RENDERED' },
+ shortFormRender: { status: 'RENDERED' },
+ }
),
};
}
@@ -63,8 +64,11 @@ test.describe('Routing - Preview Message Plan / Preview Letter template page', (
const context = getTestContext();
const user = await context.auth.getTestUser(testUsers.User1.userId);
+ const [globalLetterVariant] =
+ await context.letterVariants.getGlobalLetterVariants();
+
messagePlans = createMessagePlans(user);
- templates = createTemplates(user);
+ templates = createTemplates(user, globalLetterVariant);
await routingConfigStorageHelper.seed(Object.values(messagePlans));
await templateStorageHelper.seedTemplateData(Object.values(templates));
@@ -159,16 +163,5 @@ test.describe('Routing - Preview Message Plan / Preview Letter template page', (
await expect(page).toHaveURL(`${baseURL}/templates/invalid-template`);
});
-
- test('when template is a PDF letter', async ({ page, baseURL }) => {
- const previewLetterTemplatePage =
- new RoutingPreviewMessagePlanPreviewLetterTemplatePage(page)
- .setPathParam('messagePlanId', messagePlans.LETTER_ROUTING_CONFIG.id)
- .setPathParam('templateId', templates.PDF_LETTER.id);
-
- await previewLetterTemplatePage.loadPage();
-
- await expect(page).toHaveURL(`${baseURL}/templates/invalid-template`);
- });
});
});
diff --git a/tests/test-team/template-mgmt-routing-component-tests/preview-message-plan.routing-component.spec.ts b/tests/test-team/template-mgmt-routing-component-tests/preview-message-plan.routing-component.spec.ts
index a9198450f..0606b8373 100644
--- a/tests/test-team/template-mgmt-routing-component-tests/preview-message-plan.routing-component.spec.ts
+++ b/tests/test-team/template-mgmt-routing-component-tests/preview-message-plan.routing-component.spec.ts
@@ -1,5 +1,8 @@
import { randomUUID } from 'node:crypto';
-import type { Channel } from 'nhs-notify-web-template-management-types';
+import type {
+ Channel,
+ LetterVariant,
+} from 'nhs-notify-web-template-management-types';
import { test, expect } from '@playwright/test';
import { TestUser, testUsers } from 'helpers/auth/cognito-auth-helper';
import { RoutingConfigStorageHelper } from 'helpers/db/routing-config-storage-helper';
@@ -21,7 +24,7 @@ import { getTestContext } from 'helpers/context/context';
const routingConfigStorageHelper = new RoutingConfigStorageHelper();
const templateStorageHelper = new TemplateStorageHelper();
-function createTemplates(user: TestUser) {
+function createTemplates(user: TestUser, letterVariant: LetterVariant) {
const templateIds = {
NHSAPP: randomUUID(),
EMAIL: randomUUID(),
@@ -31,7 +34,6 @@ function createTemplates(user: TestUser) {
BSL_LETTER: randomUUID(),
FRENCH_LETTER: randomUUID(),
SPANISH_LETTER: randomUUID(),
- PDF_LETTER: randomUUID(),
};
return {
@@ -53,11 +55,16 @@ function createTemplates(user: TestUser) {
`Test SMS template - ${templateIds.SMS}`,
'SUBMITTED'
),
- LETTER: TemplateFactory.uploadPdfLetterTemplate(
+ LETTER: TemplateFactory.createAuthoringLetterTemplate(
templateIds.LETTER,
user,
`Test Letter template - ${templateIds.LETTER}`,
- 'SUBMITTED'
+ 'SUBMITTED',
+ {
+ letterVariantId: letterVariant.id,
+ shortFormRender: { status: 'RENDERED' },
+ longFormRender: { status: 'RENDERED' },
+ }
),
LARGE_PRINT_LETTER: TemplateFactory.createAuthoringLetterTemplate(
templateIds.LARGE_PRINT_LETTER,
@@ -68,6 +75,7 @@ function createTemplates(user: TestUser) {
letterType: 'x1',
shortFormRender: { status: 'RENDERED' },
longFormRender: { status: 'RENDERED' },
+ letterVariantId: letterVariant.id,
}
),
BSL_LETTER: TemplateFactory.createAuthoringLetterTemplate(
@@ -79,6 +87,7 @@ function createTemplates(user: TestUser) {
letterType: 'q4',
shortFormRender: { status: 'RENDERED' },
longFormRender: { status: 'RENDERED' },
+ letterVariantId: letterVariant.id,
}
),
FRENCH_LETTER: TemplateFactory.createAuthoringLetterTemplate(
@@ -90,6 +99,7 @@ function createTemplates(user: TestUser) {
language: 'fr',
shortFormRender: { status: 'RENDERED' },
longFormRender: { status: 'RENDERED' },
+ letterVariantId: letterVariant.id,
}
),
SPANISH_LETTER: TemplateFactory.createAuthoringLetterTemplate(
@@ -101,14 +111,9 @@ function createTemplates(user: TestUser) {
language: 'es',
shortFormRender: { status: 'RENDERED' },
longFormRender: { status: 'RENDERED' },
+ letterVariantId: letterVariant.id,
}
),
- PDF_LETTER: TemplateFactory.uploadPdfLetterTemplate(
- templateIds.PDF_LETTER,
- user,
- `Test PDF Letter template - ${templateIds.PDF_LETTER}`,
- 'SUBMITTED'
- ),
};
}
@@ -120,7 +125,11 @@ test.describe('Routing - Preview Message Plan page', () => {
test.beforeAll(async () => {
const context = getTestContext();
user = await context.auth.getTestUser(testUsers.User1.userId);
- templates = createTemplates(user);
+
+ const [globalLetterVariant] =
+ await context.letterVariants.getGlobalLetterVariants();
+
+ templates = createTemplates(user, globalLetterVariant);
await templateStorageHelper.seedTemplateData(Object.values(templates));
});
@@ -309,7 +318,7 @@ test.describe('Routing - Preview Message Plan page', () => {
templateBlock.defaultTemplateCard.templateLink
).toHaveAttribute(
'href',
- `/templates/preview-submitted-letter-template/${templates.LETTER.id}`
+ `/templates/message-plans/preview-message-plan/${dbEntry.id}/preview-template/${templates.LETTER.id}`
);
await expect(
@@ -361,61 +370,13 @@ test.describe('Routing - Preview Message Plan page', () => {
]);
await expect(newTab).toHaveURL(
- `/templates/preview-submitted-letter-template/${templates.LETTER.id}`
+ `/templates/message-plans/preview-message-plan/${dbEntry.id}/preview-template/${templates.LETTER.id}`
);
await newTab.close();
});
});
- test('displays PDF letter template link pointing to submitted letter page', async ({
- page,
- }) => {
- const { dbEntry } = RoutingConfigFactory.createWithChannels(
- user,
- ['LETTER'],
- { status: 'COMPLETED' }
- ).addTemplate('LETTER', templates.PDF_LETTER.id);
-
- await routingConfigStorageHelper.seed([dbEntry]);
-
- const previewMessagePlanPage = new RoutingPreviewMessagePlanPage(
- page
- ).setPathParam('messagePlanId', dbEntry.id);
-
- await previewMessagePlanPage.loadPage();
-
- const templateBlock =
- await previewMessagePlanPage.getTemplateBlock('LETTER');
-
- await expect(templateBlock.defaultTemplateCard.templateName).toHaveText(
- templates.PDF_LETTER.name
- );
- await expect(templateBlock.defaultTemplateCard.templateLink).toHaveText(
- 'Preview template (opens in a new tab)'
- );
- await expect(
- templateBlock.defaultTemplateCard.templateLink
- ).toHaveAttribute(
- 'href',
- `/templates/preview-submitted-letter-template/${templates.PDF_LETTER.id}`
- );
- await expect(
- templateBlock.defaultTemplateCard.templateLink
- ).toHaveAttribute('target', '_blank');
-
- const [newTab] = await Promise.all([
- page.context().waitForEvent('page'),
- templateBlock.defaultTemplateCard.templateLink.click(),
- ]);
-
- await expect(newTab).toHaveURL(
- `/templates/preview-submitted-letter-template/${templates.PDF_LETTER.id}`
- );
-
- await newTab.close();
- });
-
test('letter only with no conditional templates', async ({ page }) => {
const { dbEntry } = RoutingConfigFactory.createWithChannels(
user,
diff --git a/tests/test-team/template-mgmt-routing-component-tests/review-and-move-to-production-preview-letter-template.routing-component.spec.ts b/tests/test-team/template-mgmt-routing-component-tests/review-and-move-to-production-preview-letter-template.routing-component.spec.ts
index de340ff42..a9b42a671 100644
--- a/tests/test-team/template-mgmt-routing-component-tests/review-and-move-to-production-preview-letter-template.routing-component.spec.ts
+++ b/tests/test-team/template-mgmt-routing-component-tests/review-and-move-to-production-preview-letter-template.routing-component.spec.ts
@@ -13,6 +13,7 @@ import { RoutingReviewAndMoveToProductionPreviewLetterTemplatePage } from 'pages
import { RoutingConfigFactory } from 'helpers/factories/routing-config-factory';
import { RoutingConfigStorageHelper } from 'helpers/db/routing-config-storage-helper';
import { getTestContext } from 'helpers/context/context';
+import { LetterVariant } from 'nhs-notify-web-template-management-types';
const routingConfigStorageHelper = new RoutingConfigStorageHelper();
const templateStorageHelper = new TemplateStorageHelper();
@@ -29,11 +30,10 @@ function createMessagePlans(user: TestUser) {
};
}
-function createTemplates(user: TestUser) {
+function createTemplates(user: TestUser, letterVariant: LetterVariant) {
const templateIds = {
EMAIL: randomUUID(),
LETTER: randomUUID(),
- PDF_LETTER: randomUUID(),
};
return {
@@ -45,12 +45,13 @@ function createTemplates(user: TestUser) {
LETTER: TemplateFactory.createAuthoringLetterTemplate(
templateIds.LETTER,
user,
- `Test Letter template - ${templateIds.LETTER}`
- ),
- PDF_LETTER: TemplateFactory.uploadPdfLetterTemplate(
- templateIds.PDF_LETTER,
- user,
- `Test PDF Letter template - ${templateIds.PDF_LETTER}`
+ `Test Letter template - ${templateIds.LETTER}`,
+ 'PROOF_APPROVED',
+ {
+ letterVariantId: letterVariant.id,
+ longFormRender: { status: 'RENDERED' },
+ shortFormRender: { status: 'RENDERED' },
+ }
),
};
}
@@ -63,8 +64,11 @@ test.describe('Routing - Review and Move to Production / Preview Letter template
const context = getTestContext();
const user = await context.auth.getTestUser(testUsers.User1.userId);
+ const [globalLetterVariant] =
+ await context.letterVariants.getGlobalLetterVariants();
+
messagePlans = createMessagePlans(user);
- templates = createTemplates(user);
+ templates = createTemplates(user, globalLetterVariant);
await routingConfigStorageHelper.seed(Object.values(messagePlans));
await templateStorageHelper.seedTemplateData(Object.values(templates));
@@ -159,16 +163,5 @@ test.describe('Routing - Review and Move to Production / Preview Letter template
await expect(page).toHaveURL(`${baseURL}/templates/invalid-template`);
});
-
- test('when template is a PDF letter', async ({ page, baseURL }) => {
- const previewLetterTemplatePage =
- new RoutingReviewAndMoveToProductionPreviewLetterTemplatePage(page)
- .setPathParam('messagePlanId', messagePlans.LETTER_ROUTING_CONFIG.id)
- .setPathParam('templateId', templates.PDF_LETTER.id);
-
- await previewLetterTemplatePage.loadPage();
-
- await expect(page).toHaveURL(`${baseURL}/templates/invalid-template`);
- });
});
});
diff --git a/tests/test-team/template-mgmt-routing-component-tests/review-and-move-to-production.routing-component.spec.ts b/tests/test-team/template-mgmt-routing-component-tests/review-and-move-to-production.routing-component.spec.ts
index 98f7d8d76..6be7e7346 100644
--- a/tests/test-team/template-mgmt-routing-component-tests/review-and-move-to-production.routing-component.spec.ts
+++ b/tests/test-team/template-mgmt-routing-component-tests/review-and-move-to-production.routing-component.spec.ts
@@ -1,5 +1,8 @@
import { randomUUID } from 'node:crypto';
-import type { Channel } from 'nhs-notify-web-template-management-types';
+import type {
+ Channel,
+ LetterVariant,
+} from 'nhs-notify-web-template-management-types';
import { test, expect } from '@playwright/test';
import { TestUser, testUsers } from 'helpers/auth/cognito-auth-helper';
import { RoutingConfigStorageHelper } from 'helpers/db/routing-config-storage-helper';
@@ -20,7 +23,7 @@ import { getTestContext } from 'helpers/context/context';
const routingConfigStorageHelper = new RoutingConfigStorageHelper();
const templateStorageHelper = new TemplateStorageHelper();
-function createTemplates(user: TestUser) {
+function createTemplates(user: TestUser, letterVariant: LetterVariant) {
const templateIds = {
NHSAPP: randomUUID(),
EMAIL: randomUUID(),
@@ -30,7 +33,6 @@ function createTemplates(user: TestUser) {
BSL_LETTER: randomUUID(),
FRENCH_LETTER: randomUUID(),
SPANISH_LETTER: randomUUID(),
- PDF_LETTER: randomUUID(),
};
return {
@@ -56,6 +58,7 @@ function createTemplates(user: TestUser) {
`Test Letter template - ${templateIds.LETTER}`,
'SUBMITTED',
{
+ letterVariantId: letterVariant.id,
shortFormRender: { status: 'RENDERED' },
longFormRender: { status: 'RENDERED' },
}
@@ -69,6 +72,7 @@ function createTemplates(user: TestUser) {
letterType: 'x1',
shortFormRender: { status: 'RENDERED' },
longFormRender: { status: 'RENDERED' },
+ letterVariantId: letterVariant.id,
}
),
BSL_LETTER: TemplateFactory.createAuthoringLetterTemplate(
@@ -80,6 +84,7 @@ function createTemplates(user: TestUser) {
letterType: 'q4',
shortFormRender: { status: 'RENDERED' },
longFormRender: { status: 'RENDERED' },
+ letterVariantId: letterVariant.id,
}
),
FRENCH_LETTER: TemplateFactory.createAuthoringLetterTemplate(
@@ -91,6 +96,7 @@ function createTemplates(user: TestUser) {
language: 'fr',
shortFormRender: { status: 'RENDERED' },
longFormRender: { status: 'RENDERED' },
+ letterVariantId: letterVariant.id,
}
),
SPANISH_LETTER: TemplateFactory.createAuthoringLetterTemplate(
@@ -102,14 +108,9 @@ function createTemplates(user: TestUser) {
language: 'es',
shortFormRender: { status: 'RENDERED' },
longFormRender: { status: 'RENDERED' },
+ letterVariantId: letterVariant.id,
}
),
- PDF_LETTER: TemplateFactory.uploadPdfLetterTemplate(
- templateIds.PDF_LETTER,
- user,
- `Test PDF Letter template - ${templateIds.PDF_LETTER}`,
- 'SUBMITTED'
- ),
};
}
@@ -121,7 +122,11 @@ test.describe('Routing - Review and Move to Production page', () => {
test.beforeAll(async () => {
const context = getTestContext();
user = await context.auth.getTestUser(testUsers.User1.userId);
- templates = createTemplates(user);
+
+ const [globalLetterVariant] =
+ await context.letterVariants.getGlobalLetterVariants();
+
+ templates = createTemplates(user, globalLetterVariant);
await templateStorageHelper.seedTemplateData(Object.values(templates));
});
@@ -372,53 +377,6 @@ test.describe('Routing - Review and Move to Production page', () => {
});
});
- test('displays PDF letter template link pointing to submitted letter page', async ({
- page,
- }) => {
- const { dbEntry } = RoutingConfigFactory.createWithChannels(
- user,
- ['LETTER'],
- { status: 'DRAFT' }
- ).addTemplate('LETTER', templates.PDF_LETTER.id);
-
- await routingConfigStorageHelper.seed([dbEntry]);
-
- const reviewPage = new RoutingReviewAndMoveToProductionPage(
- page
- ).setPathParam('messagePlanId', dbEntry.id);
-
- await reviewPage.loadPage();
-
- const templateBlock = await reviewPage.getTemplateBlock('LETTER');
-
- await expect(templateBlock.defaultTemplateCard.templateName).toHaveText(
- templates.PDF_LETTER.name
- );
- await expect(templateBlock.defaultTemplateCard.templateLink).toHaveText(
- 'Preview template (opens in a new tab)'
- );
- await expect(
- templateBlock.defaultTemplateCard.templateLink
- ).toHaveAttribute(
- 'href',
- `/templates/preview-submitted-letter-template/${templates.PDF_LETTER.id}`
- );
- await expect(
- templateBlock.defaultTemplateCard.templateLink
- ).toHaveAttribute('target', '_blank');
-
- const [newTab] = await Promise.all([
- page.context().waitForEvent('page'),
- templateBlock.defaultTemplateCard.templateLink.click(),
- ]);
-
- await expect(newTab).toHaveURL(
- `/templates/preview-submitted-letter-template/${templates.PDF_LETTER.id}`
- );
-
- await newTab.close();
- });
-
test('keep in draft button navigates to the edit message plan page', async ({
page,
baseURL,
From e667993af50bc6ba1fdd14f2290b756ccdf6d57b Mon Sep 17 00:00:00 2001
From: "alex.nuttall1"
Date: Wed, 8 Apr 2026 19:08:19 +0100
Subject: [PATCH 53/57] make test fixture PROOF_APPROVED
---
.../molecules/MessagePlanCascadePreview.test.tsx | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/frontend/src/__tests__/components/molecules/MessagePlanCascadePreview.test.tsx b/frontend/src/__tests__/components/molecules/MessagePlanCascadePreview.test.tsx
index 70a43f288..6ba782925 100644
--- a/frontend/src/__tests__/components/molecules/MessagePlanCascadePreview.test.tsx
+++ b/frontend/src/__tests__/components/molecules/MessagePlanCascadePreview.test.tsx
@@ -52,7 +52,7 @@ describe('MessagePlanCascadePreview', () => {
expect(templateNames[0]).toHaveTextContent(NHS_APP_TEMPLATE.name);
expect(templateNames[1]).toHaveTextContent(EMAIL_TEMPLATE.name);
expect(templateNames[2]).toHaveTextContent(SMS_TEMPLATE.name);
- expect(templateNames[3]).toHaveTextContent(AUTHORING_LETTER_TEMPLATE.name);
+ expect(templateNames[3]).toHaveTextContent(APPROVED_LETTER.name);
});
it('renders open/close all previews button when non-letter channels present', () => {
@@ -79,7 +79,7 @@ describe('MessagePlanCascadePreview', () => {
cascadeGroups: ['standard' as const],
channel: 'LETTER' as const,
channelType: 'primary' as const,
- defaultTemplateId: AUTHORING_LETTER_TEMPLATE.id,
+ defaultTemplateId: APPROVED_LETTER.id,
},
],
};
@@ -156,7 +156,7 @@ describe('MessagePlanCascadePreview', () => {
const link = letterBlock.querySelector('a');
expect(link).toHaveAttribute(
'href',
- `/base-url/preview-template/${AUTHORING_LETTER_TEMPLATE.id}`
+ `/base-url/preview-template/${APPROVED_LETTER.id}`
);
expect(link).toHaveAttribute('target', '_blank');
expect(link).toHaveTextContent('Preview template (opens in a new tab)');
@@ -180,7 +180,7 @@ describe('MessagePlanCascadePreview', () => {
[NHS_APP_TEMPLATE.id]: NHS_APP_TEMPLATE,
// EMAIL_TEMPLATE is missing
[SMS_TEMPLATE.id]: SMS_TEMPLATE,
- [AUTHORING_LETTER_TEMPLATE.id]: AUTHORING_LETTER_TEMPLATE,
+ [APPROVED_LETTER.id]: APPROVED_LETTER,
};
render(
From 57b51f32532c255128ebd0da98b0c21e4ce2fb39 Mon Sep 17 00:00:00 2001
From: "alex.nuttall1"
Date: Wed, 8 Apr 2026 19:44:33 +0100
Subject: [PATCH 54/57] accessibility test fix
---
.../routing.accessibility.spec.ts | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tests/test-team/template-mgmt-accessibility/routing.accessibility.spec.ts b/tests/test-team/template-mgmt-accessibility/routing.accessibility.spec.ts
index 593bd540f..6d2cc5c4d 100644
--- a/tests/test-team/template-mgmt-accessibility/routing.accessibility.spec.ts
+++ b/tests/test-team/template-mgmt-accessibility/routing.accessibility.spec.ts
@@ -64,6 +64,9 @@ test.describe('Routing', () => {
testUsers.UserWithMultipleCampaigns.userId
);
+ const [globalLetterVariant] =
+ await context.letterVariants.getGlobalLetterVariants();
+
const createRoutingConfig = (id: string, status: RoutingConfigStatus) =>
RoutingConfigFactory.createForMessageOrder(user, messageOrder, {
id,
@@ -126,6 +129,7 @@ test.describe('Routing', () => {
{
shortFormRender: { status: 'RENDERED' },
longFormRender: { status: 'RENDERED' },
+ letterVariantId: globalLetterVariant.id,
}
),
TemplateFactory.createAuthoringLetterTemplate(
@@ -137,6 +141,7 @@ test.describe('Routing', () => {
letterType: 'x1',
shortFormRender: { status: 'RENDERED' },
longFormRender: { status: 'RENDERED' },
+ letterVariantId: globalLetterVariant.id,
}
),
TemplateFactory.createAuthoringLetterTemplate(
@@ -148,6 +153,7 @@ test.describe('Routing', () => {
letterType: 'q4',
shortFormRender: { status: 'RENDERED' },
longFormRender: { status: 'RENDERED' },
+ letterVariantId: globalLetterVariant.id,
}
),
TemplateFactory.createAuthoringLetterTemplate(
@@ -159,6 +165,7 @@ test.describe('Routing', () => {
language: 'fr',
shortFormRender: { status: 'RENDERED' },
longFormRender: { status: 'RENDERED' },
+ letterVariantId: globalLetterVariant.id,
}
),
]);
From 5e570b085a0e7808e695870770f533d70000d0a6 Mon Sep 17 00:00:00 2001
From: "alex.nuttall1"
Date: Thu, 9 Apr 2026 07:44:17 +0100
Subject: [PATCH 55/57] pw tests on missing variants
---
.../page.test.tsx | 4 +-
.../page.test.tsx | 18 +++++--
.../ChooseChannelTemplate.test.tsx | 8 +++-
.../SummaryLetterFromMessagePlan.test.tsx | 2 -
...-letter-template.routing-component.spec.ts | 48 ++++++++++++++++---
...-letter-template.routing-component.spec.ts | 48 ++++++++++++++++---
...-letter-template.routing-component.spec.ts | 34 +++++++++++--
...-letter-template.routing-component.spec.ts | 41 ++++++++++++++--
...-letter-template.routing-component.spec.ts | 39 ++++++++++++---
...-letter-template.routing-component.spec.ts | 37 +++++++++++---
10 files changed, 235 insertions(+), 44 deletions(-)
diff --git a/frontend/src/__tests__/app/message-plans/choose-standard-english-letter-template/page.test.tsx b/frontend/src/__tests__/app/message-plans/choose-standard-english-letter-template/page.test.tsx
index 72db01cce..cf5c4c03a 100644
--- a/frontend/src/__tests__/app/message-plans/choose-standard-english-letter-template/page.test.tsx
+++ b/frontend/src/__tests__/app/message-plans/choose-standard-english-letter-template/page.test.tsx
@@ -66,7 +66,9 @@ describe('ChooseStandardEnglishLetterTemplate page', () => {
it('renders letter template selection', async () => {
getRoutingConfigMock.mockResolvedValueOnce(ROUTING_CONFIG);
- getTemplatesMock.mockResolvedValueOnce([AUTHORING_LETTER_TEMPLATE]);
+ getTemplatesMock.mockResolvedValueOnce([
+ { ...AUTHORING_LETTER_TEMPLATE, templateStatus: 'PROOF_APPROVED' },
+ ]);
const page = await ChooseStandardEnglishLetterTemplate({
params: Promise.resolve({
diff --git a/frontend/src/__tests__/app/message-plans/review-and-move-to-production/page.test.tsx b/frontend/src/__tests__/app/message-plans/review-and-move-to-production/page.test.tsx
index 1303193ab..adf61dbb4 100644
--- a/frontend/src/__tests__/app/message-plans/review-and-move-to-production/page.test.tsx
+++ b/frontend/src/__tests__/app/message-plans/review-and-move-to-production/page.test.tsx
@@ -67,9 +67,21 @@ const templates: MessagePlanTemplates = {
[appTemplateId]: { ...NHS_APP_TEMPLATE, id: appTemplateId },
[emailTemplateId]: { ...EMAIL_TEMPLATE, id: emailTemplateId },
[smsTemplateId]: { ...SMS_TEMPLATE, id: smsTemplateId },
- [letterTemplateId]: { ...AUTHORING_LETTER_TEMPLATE, id: letterTemplateId },
- [kuTemplateId]: { ...AUTHORING_LETTER_TEMPLATE, id: kuTemplateId },
- [sqTemplateId]: { ...AUTHORING_LETTER_TEMPLATE, id: sqTemplateId },
+ [letterTemplateId]: {
+ ...AUTHORING_LETTER_TEMPLATE,
+ id: letterTemplateId,
+ templateStatus: 'PROOF_APPROVED',
+ },
+ [kuTemplateId]: {
+ ...AUTHORING_LETTER_TEMPLATE,
+ id: kuTemplateId,
+ templateStatus: 'PROOF_APPROVED',
+ },
+ [sqTemplateId]: {
+ ...AUTHORING_LETTER_TEMPLATE,
+ id: sqTemplateId,
+ templateStatus: 'PROOF_APPROVED',
+ },
[largePrintTemplateId]: {
...LARGE_PRINT_LETTER_TEMPLATE,
id: largePrintTemplateId,
diff --git a/frontend/src/__tests__/components/forms/ChooseChannelTemplate/ChooseChannelTemplate.test.tsx b/frontend/src/__tests__/components/forms/ChooseChannelTemplate/ChooseChannelTemplate.test.tsx
index d82a7bbb0..118b4b814 100644
--- a/frontend/src/__tests__/components/forms/ChooseChannelTemplate/ChooseChannelTemplate.test.tsx
+++ b/frontend/src/__tests__/components/forms/ChooseChannelTemplate/ChooseChannelTemplate.test.tsx
@@ -97,12 +97,16 @@ const propsByChannel = {
LETTER: {
pageHeading: 'Choose a letter template',
cascadeIndex: 3,
- templateList: [AUTHORING_LETTER_TEMPLATE],
+ templateList: [
+ { ...AUTHORING_LETTER_TEMPLATE, templateStatus: 'PROOF_APPROVED' },
+ ],
},
LARGE_PRINT_LETTER: {
pageHeading: 'Choose a large print letter template',
cascadeIndex: 3,
- templateList: [LARGE_PRINT_LETTER_TEMPLATE],
+ templateList: [
+ { ...LARGE_PRINT_LETTER_TEMPLATE, templateStatus: 'SUBMITTED' },
+ ],
accessibleFormat: 'x1',
},
};
diff --git a/frontend/src/__tests__/components/molecules/SummaryLetterFromMessagePlan.test.tsx b/frontend/src/__tests__/components/molecules/SummaryLetterFromMessagePlan.test.tsx
index 864883577..d54ff53ca 100644
--- a/frontend/src/__tests__/components/molecules/SummaryLetterFromMessagePlan.test.tsx
+++ b/frontend/src/__tests__/components/molecules/SummaryLetterFromMessagePlan.test.tsx
@@ -7,7 +7,6 @@ import {
import { render } from '@testing-library/react';
import { getLetterVariantById, getTemplate } from '@utils/form-actions';
import { redirect } from 'next/navigation';
-import { validateAuthoringLetterTemplate } from 'nhs-notify-web-template-management-utils';
import type { TemplateDto } from 'nhs-notify-web-template-management-types';
jest.mock('@utils/form-actions');
@@ -23,7 +22,6 @@ const defaultProps = {
templateId: 'template-id',
}),
searchParams: Promise.resolve({}),
- validateTemplate: validateAuthoringLetterTemplate,
};
describe('SummaryLetterFromMessagePlan', () => {
diff --git a/tests/test-team/template-mgmt-routing-component-tests/letter/preview-british-sign-language-letter-template.routing-component.spec.ts b/tests/test-team/template-mgmt-routing-component-tests/letter/preview-british-sign-language-letter-template.routing-component.spec.ts
index 5dfdc443d..ec8ea410d 100644
--- a/tests/test-team/template-mgmt-routing-component-tests/letter/preview-british-sign-language-letter-template.routing-component.spec.ts
+++ b/tests/test-team/template-mgmt-routing-component-tests/letter/preview-british-sign-language-letter-template.routing-component.spec.ts
@@ -21,7 +21,14 @@ const routingConfigStorageHelper = new RoutingConfigStorageHelper();
const templateStorageHelper = new TemplateStorageHelper();
const invalidTemplateId = 'invalid-id';
-const notFoundTemplateId = 'dc67b576-af7d-47b3-97d7-48fa204e7525';
+const notFoundTemplateId = randomUUID();
+
+const templateIds = {
+ EMAIL: randomUUID(),
+ STANDARD_LETTER: randomUUID(),
+ BSL_LETTER: randomUUID(),
+ BSL_LETTER_WITHOUT_VARIANT: randomUUID(),
+};
function createMessagePlans(user: TestUser) {
return {
@@ -35,14 +42,14 @@ function createMessagePlans(user: TestUser) {
function createTemplates(user: TestUser, letterVariant: LetterVariant) {
return {
EMAIL: TemplateFactory.createEmailTemplate(
- randomUUID(),
+ templateIds.EMAIL,
user,
- 'Email template name'
+ `Email template name - ${templateIds.EMAIL}`
),
STANDARD_LETTER: TemplateFactory.createAuthoringLetterTemplate(
- randomUUID(),
+ templateIds.STANDARD_LETTER,
user,
- 'Standard letter template name',
+ `Standard letter template name - ${templateIds.STANDARD_LETTER}`,
'SUBMITTED',
{
shortFormRender: { status: 'RENDERED' },
@@ -51,9 +58,9 @@ function createTemplates(user: TestUser, letterVariant: LetterVariant) {
}
),
BSL_LETTER: TemplateFactory.createAuthoringLetterTemplate(
- randomUUID(),
+ templateIds.BSL_LETTER,
user,
- 'BSL letter template name',
+ `BSL letter template name - ${templateIds.BSL_LETTER}`,
'SUBMITTED',
{
letterType: 'q4',
@@ -62,6 +69,17 @@ function createTemplates(user: TestUser, letterVariant: LetterVariant) {
letterVariantId: letterVariant.id,
}
),
+ BSL_LETTER_WITHOUT_VARIANT: TemplateFactory.createAuthoringLetterTemplate(
+ templateIds.BSL_LETTER_WITHOUT_VARIANT,
+ user,
+ `BSL letter template no variant - ${templateIds.BSL_LETTER_WITHOUT_VARIANT}`,
+ 'PROOF_APPROVED',
+ {
+ letterType: 'q4',
+ shortFormRender: { status: 'RENDERED' },
+ longFormRender: { status: 'RENDERED' },
+ }
+ ),
};
}
@@ -234,6 +252,22 @@ test.describe('Routing - Preview British Sign Language letter template page', ()
await expect(page).toHaveURL(`${baseURL}/templates/invalid-template`);
});
+
+ test('when template does not have a letterVariantId', async ({
+ page,
+ baseURL,
+ }) => {
+ const previewBSLLetterTemplatePage =
+ new RoutingPreviewBritishSignLanguageLetterTemplatePage(page);
+
+ await previewBSLLetterTemplatePage
+ .setPathParam('messagePlanId', messagePlans.LETTER_ROUTING_CONFIG.id)
+ .setPathParam('templateId', templates.BSL_LETTER_WITHOUT_VARIANT.id)
+ .setSearchParam('lockNumber', '0')
+ .loadPage();
+
+ await expect(page).toHaveURL(`${baseURL}/templates/invalid-template`);
+ });
});
test('redirects to the edit message plan page when lockNumber is missing', async ({
diff --git a/tests/test-team/template-mgmt-routing-component-tests/letter/preview-large-print-letter-template.routing-component.spec.ts b/tests/test-team/template-mgmt-routing-component-tests/letter/preview-large-print-letter-template.routing-component.spec.ts
index e927984e4..6a6079886 100644
--- a/tests/test-team/template-mgmt-routing-component-tests/letter/preview-large-print-letter-template.routing-component.spec.ts
+++ b/tests/test-team/template-mgmt-routing-component-tests/letter/preview-large-print-letter-template.routing-component.spec.ts
@@ -21,7 +21,14 @@ const routingConfigStorageHelper = new RoutingConfigStorageHelper();
const templateStorageHelper = new TemplateStorageHelper();
const invalidTemplateId = 'invalid-id';
-const notFoundTemplateId = 'dc67b576-af7d-47b3-97d7-48fa204e7525';
+const notFoundTemplateId = randomUUID();
+
+const templateIds = {
+ EMAIL: randomUUID(),
+ STANDARD_LETTER: randomUUID(),
+ LARGE_PRINT_LETTER: randomUUID(),
+ LARGE_PRINT_LETTER_WITHOUT_VARIANT: randomUUID(),
+};
function createMessagePlans(user: TestUser) {
return {
@@ -35,14 +42,14 @@ function createMessagePlans(user: TestUser) {
function createTemplates(user: TestUser, letterVariant: LetterVariant) {
return {
EMAIL: TemplateFactory.createEmailTemplate(
- randomUUID(),
+ templateIds.EMAIL,
user,
- 'Email template name'
+ `Email template name - ${templateIds.EMAIL}`
),
STANDARD_LETTER: TemplateFactory.createAuthoringLetterTemplate(
- randomUUID(),
+ templateIds.STANDARD_LETTER,
user,
- 'Standard letter template name',
+ `Standard letter template name - ${templateIds.STANDARD_LETTER}`,
'SUBMITTED',
{
shortFormRender: { status: 'RENDERED' },
@@ -51,9 +58,9 @@ function createTemplates(user: TestUser, letterVariant: LetterVariant) {
}
),
LARGE_PRINT_LETTER: TemplateFactory.createAuthoringLetterTemplate(
- randomUUID(),
+ templateIds.LARGE_PRINT_LETTER,
user,
- 'Authoring large print letter template name',
+ `Large print letter template name - ${templateIds.LARGE_PRINT_LETTER}`,
'SUBMITTED',
{
letterType: 'x1',
@@ -62,6 +69,17 @@ function createTemplates(user: TestUser, letterVariant: LetterVariant) {
letterVariantId: letterVariant.id,
}
),
+ LARGE_PRINT_LETTER_WITHOUT_VARIANT: TemplateFactory.createAuthoringLetterTemplate(
+ templateIds.LARGE_PRINT_LETTER_WITHOUT_VARIANT,
+ user,
+ `Large print letter template no variant - ${templateIds.LARGE_PRINT_LETTER_WITHOUT_VARIANT}`,
+ 'PROOF_APPROVED',
+ {
+ letterType: 'x1',
+ shortFormRender: { status: 'RENDERED' },
+ longFormRender: { status: 'RENDERED' },
+ }
+ ),
};
}
@@ -232,6 +250,22 @@ test.describe('Routing - Preview large print letter template page', () => {
await expect(page).toHaveURL(`${baseURL}/templates/invalid-template`);
});
+
+ test('when template does not have a letterVariantId', async ({
+ page,
+ baseURL,
+ }) => {
+ const previewLargePrintLetterTemplatePage =
+ new RoutingPreviewLargePrintLetterTemplatePage(page);
+
+ await previewLargePrintLetterTemplatePage
+ .setPathParam('messagePlanId', messagePlans.LETTER_ROUTING_CONFIG.id)
+ .setPathParam('templateId', templates.LARGE_PRINT_LETTER_WITHOUT_VARIANT.id)
+ .setSearchParam('lockNumber', '0')
+ .loadPage();
+
+ await expect(page).toHaveURL(`${baseURL}/templates/invalid-template`);
+ });
});
test('redirects to the edit message plan page when lockNumber is missing', async ({
diff --git a/tests/test-team/template-mgmt-routing-component-tests/letter/preview-other-language-letter-template.routing-component.spec.ts b/tests/test-team/template-mgmt-routing-component-tests/letter/preview-other-language-letter-template.routing-component.spec.ts
index 67a6efba1..ac7500576 100644
--- a/tests/test-team/template-mgmt-routing-component-tests/letter/preview-other-language-letter-template.routing-component.spec.ts
+++ b/tests/test-team/template-mgmt-routing-component-tests/letter/preview-other-language-letter-template.routing-component.spec.ts
@@ -26,8 +26,8 @@ const notFoundTemplateId = randomUUID();
const templateIds = {
EMAIL: randomUUID(),
STANDARD_LETTER: randomUUID(),
- FRENCH_LETTER: randomUUID(),
AUTHORING_FRENCH_LETTER: randomUUID(),
+ FRENCH_LETTER_WITHOUT_VARIANT: randomUUID(),
};
function createMessagePlans(user: TestUser) {
@@ -44,12 +44,12 @@ function createTemplates(user: TestUser, letterVariant: LetterVariant) {
EMAIL: TemplateFactory.createEmailTemplate(
templateIds.EMAIL,
user,
- 'Email template name'
+ `Email template name - ${templateIds.EMAIL}`
),
STANDARD_LETTER: TemplateFactory.createAuthoringLetterTemplate(
templateIds.STANDARD_LETTER,
user,
- 'Standard letter template name',
+ `Standard letter template name - ${templateIds.STANDARD_LETTER}`,
'PROOF_APPROVED',
{
shortFormRender: { status: 'RENDERED' },
@@ -60,7 +60,7 @@ function createTemplates(user: TestUser, letterVariant: LetterVariant) {
FRENCH_LETTER: TemplateFactory.createAuthoringLetterTemplate(
templateIds.AUTHORING_FRENCH_LETTER,
user,
- 'Authoring French letter template name',
+ `French letter template name - ${templateIds.AUTHORING_FRENCH_LETTER}`,
'SUBMITTED',
{
language: 'fr',
@@ -69,6 +69,17 @@ function createTemplates(user: TestUser, letterVariant: LetterVariant) {
letterVariantId: letterVariant.id,
}
),
+ FRENCH_LETTER_WITHOUT_VARIANT: TemplateFactory.createAuthoringLetterTemplate(
+ templateIds.FRENCH_LETTER_WITHOUT_VARIANT,
+ user,
+ `French letter template no variant - ${templateIds.FRENCH_LETTER_WITHOUT_VARIANT}`,
+ 'PROOF_APPROVED',
+ {
+ language: 'fr',
+ shortFormRender: { status: 'RENDERED' },
+ longFormRender: { status: 'RENDERED' },
+ }
+ ),
};
}
@@ -247,6 +258,21 @@ test.describe('Routing - Preview foreign language letter template page', () => {
await expect(page).toHaveURL(`${baseURL}/templates/invalid-template`);
});
+
+ test('when template does not have a letterVariantId', async ({
+ page,
+ baseURL,
+ }) => {
+ const previewForeignLanguageLetterTemplatePage =
+ new RoutingPreviewOtherLanguageLetterTemplatePage(page)
+ .setPathParam('messagePlanId', messagePlans.LETTER_ROUTING_CONFIG.id)
+ .setPathParam('templateId', templates.FRENCH_LETTER_WITHOUT_VARIANT.id)
+ .setSearchParam('lockNumber', '0');
+
+ await previewForeignLanguageLetterTemplatePage.loadPage();
+
+ await expect(page).toHaveURL(`${baseURL}/templates/invalid-template`);
+ });
});
test('redirects to the edit message plan page when lockNumber is missing', async ({
diff --git a/tests/test-team/template-mgmt-routing-component-tests/letter/preview-standard-letter-template.routing-component.spec.ts b/tests/test-team/template-mgmt-routing-component-tests/letter/preview-standard-letter-template.routing-component.spec.ts
index 7be56755a..34c5eb345 100644
--- a/tests/test-team/template-mgmt-routing-component-tests/letter/preview-standard-letter-template.routing-component.spec.ts
+++ b/tests/test-team/template-mgmt-routing-component-tests/letter/preview-standard-letter-template.routing-component.spec.ts
@@ -21,7 +21,13 @@ const routingConfigStorageHelper = new RoutingConfigStorageHelper();
const templateStorageHelper = new TemplateStorageHelper();
const invalidTemplateId = 'invalid-id';
-const notFoundTemplateId = 'dc67b576-af7d-47b3-97d7-48fa204e7525';
+const notFoundTemplateId = randomUUID();
+
+const templateIds = {
+ EMAIL: randomUUID(),
+ LETTER: randomUUID(),
+ LETTER_WITHOUT_VARIANT: randomUUID(),
+};
function createMessagePlans(user: TestUser) {
return {
@@ -35,14 +41,14 @@ function createMessagePlans(user: TestUser) {
function createTemplates(user: TestUser, letterVariant: LetterVariant) {
return {
EMAIL: TemplateFactory.createEmailTemplate(
- randomUUID(),
+ templateIds.EMAIL,
user,
- 'Email template name'
+ `Email template name - ${templateIds.EMAIL}`
),
LETTER: TemplateFactory.createAuthoringLetterTemplate(
- randomUUID(),
+ templateIds.LETTER,
user,
- 'Letter template name',
+ `Letter template name - ${templateIds.LETTER}`,
'PROOF_APPROVED',
{
shortFormRender: { status: 'RENDERED' },
@@ -50,6 +56,16 @@ function createTemplates(user: TestUser, letterVariant: LetterVariant) {
letterVariantId: letterVariant.id,
}
),
+ LETTER_WITHOUT_VARIANT: TemplateFactory.createAuthoringLetterTemplate(
+ templateIds.LETTER_WITHOUT_VARIANT,
+ user,
+ `Letter template no variant - ${templateIds.LETTER_WITHOUT_VARIANT}`,
+ 'PROOF_APPROVED',
+ {
+ shortFormRender: { status: 'RENDERED' },
+ longFormRender: { status: 'RENDERED' },
+ }
+ ),
};
}
@@ -168,6 +184,21 @@ test.describe('Routing - Preview Letter template page', () => {
await expect(page).toHaveURL(`${baseURL}/templates/invalid-template`);
});
+
+ test('when template does not have a letterVariantId', async ({
+ page,
+ baseURL,
+ }) => {
+ const previewLetterTemplatePage =
+ new RoutingPreviewStandardLetterTemplatePage(page)
+ .setPathParam('messagePlanId', messagePlans.LETTER_ROUTING_CONFIG.id)
+ .setPathParam('templateId', templates.LETTER_WITHOUT_VARIANT.id)
+ .setSearchParam('lockNumber', '0');
+
+ await previewLetterTemplatePage.loadPage();
+
+ await expect(page).toHaveURL(`${baseURL}/templates/invalid-template`);
+ });
});
test('redirects to the edit message plan page when lockNumber is missing', async ({
diff --git a/tests/test-team/template-mgmt-routing-component-tests/preview-message-plan-preview-letter-template.routing-component.spec.ts b/tests/test-team/template-mgmt-routing-component-tests/preview-message-plan-preview-letter-template.routing-component.spec.ts
index 60bef3bb0..4f69ab45a 100644
--- a/tests/test-team/template-mgmt-routing-component-tests/preview-message-plan-preview-letter-template.routing-component.spec.ts
+++ b/tests/test-team/template-mgmt-routing-component-tests/preview-message-plan-preview-letter-template.routing-component.spec.ts
@@ -19,7 +19,13 @@ const routingConfigStorageHelper = new RoutingConfigStorageHelper();
const templateStorageHelper = new TemplateStorageHelper();
const invalidTemplateId = 'invalid-id';
-const notFoundTemplateId = 'dc67b576-af7d-47b3-97d7-48fa204e7525';
+const notFoundTemplateId = randomUUID();
+
+const templateIds = {
+ EMAIL: randomUUID(),
+ LETTER: randomUUID(),
+ LETTER_WITHOUT_VARIANT: randomUUID(),
+};
function createMessagePlans(user: TestUser) {
return {
@@ -31,11 +37,6 @@ function createMessagePlans(user: TestUser) {
}
function createTemplates(user: TestUser, letterVariant: LetterVariant) {
- const templateIds = {
- EMAIL: randomUUID(),
- LETTER: randomUUID(),
- };
-
return {
EMAIL: TemplateFactory.createEmailTemplate(
templateIds.EMAIL,
@@ -45,7 +46,7 @@ function createTemplates(user: TestUser, letterVariant: LetterVariant) {
LETTER: TemplateFactory.createAuthoringLetterTemplate(
templateIds.LETTER,
user,
- `Test Authoring Letter template - ${templateIds.LETTER}`,
+ `Test Letter template - ${templateIds.LETTER}`,
'PROOF_APPROVED',
{
letterVariantId: letterVariant.id,
@@ -53,6 +54,16 @@ function createTemplates(user: TestUser, letterVariant: LetterVariant) {
shortFormRender: { status: 'RENDERED' },
}
),
+ LETTER_WITHOUT_VARIANT: TemplateFactory.createAuthoringLetterTemplate(
+ templateIds.LETTER_WITHOUT_VARIANT,
+ user,
+ `Test Letter template no variant - ${templateIds.LETTER_WITHOUT_VARIANT}`,
+ 'PROOF_APPROVED',
+ {
+ longFormRender: { status: 'RENDERED' },
+ shortFormRender: { status: 'RENDERED' },
+ }
+ ),
};
}
@@ -163,5 +174,19 @@ test.describe('Routing - Preview Message Plan / Preview Letter template page', (
await expect(page).toHaveURL(`${baseURL}/templates/invalid-template`);
});
+
+ test('when template does not have a letterVariantId', async ({
+ page,
+ baseURL,
+ }) => {
+ const previewLetterTemplatePage =
+ new RoutingPreviewMessagePlanPreviewLetterTemplatePage(page)
+ .setPathParam('messagePlanId', messagePlans.LETTER_ROUTING_CONFIG.id)
+ .setPathParam('templateId', templates.LETTER_WITHOUT_VARIANT.id);
+
+ await previewLetterTemplatePage.loadPage();
+
+ await expect(page).toHaveURL(`${baseURL}/templates/invalid-template`);
+ });
});
});
diff --git a/tests/test-team/template-mgmt-routing-component-tests/review-and-move-to-production-preview-letter-template.routing-component.spec.ts b/tests/test-team/template-mgmt-routing-component-tests/review-and-move-to-production-preview-letter-template.routing-component.spec.ts
index a9b42a671..e3587f3a5 100644
--- a/tests/test-team/template-mgmt-routing-component-tests/review-and-move-to-production-preview-letter-template.routing-component.spec.ts
+++ b/tests/test-team/template-mgmt-routing-component-tests/review-and-move-to-production-preview-letter-template.routing-component.spec.ts
@@ -19,7 +19,13 @@ const routingConfigStorageHelper = new RoutingConfigStorageHelper();
const templateStorageHelper = new TemplateStorageHelper();
const invalidTemplateId = 'invalid-id';
-const notFoundTemplateId = 'dc67b576-af7d-47b3-97d7-48fa204e7525';
+const notFoundTemplateId = randomUUID();
+
+const templateIds = {
+ EMAIL: randomUUID(),
+ LETTER: randomUUID(),
+ LETTER_WITHOUT_VARIANT: randomUUID(),
+};
function createMessagePlans(user: TestUser) {
return {
@@ -31,11 +37,6 @@ function createMessagePlans(user: TestUser) {
}
function createTemplates(user: TestUser, letterVariant: LetterVariant) {
- const templateIds = {
- EMAIL: randomUUID(),
- LETTER: randomUUID(),
- };
-
return {
EMAIL: TemplateFactory.createEmailTemplate(
templateIds.EMAIL,
@@ -53,6 +54,16 @@ function createTemplates(user: TestUser, letterVariant: LetterVariant) {
shortFormRender: { status: 'RENDERED' },
}
),
+ LETTER_WITHOUT_VARIANT: TemplateFactory.createAuthoringLetterTemplate(
+ templateIds.LETTER_WITHOUT_VARIANT,
+ user,
+ `Test Letter template no variant - ${templateIds.LETTER_WITHOUT_VARIANT}`,
+ 'PROOF_APPROVED',
+ {
+ longFormRender: { status: 'RENDERED' },
+ shortFormRender: { status: 'RENDERED' },
+ }
+ ),
};
}
@@ -163,5 +174,19 @@ test.describe('Routing - Review and Move to Production / Preview Letter template
await expect(page).toHaveURL(`${baseURL}/templates/invalid-template`);
});
+
+ test('when template does not have a letterVariantId', async ({
+ page,
+ baseURL,
+ }) => {
+ const previewLetterTemplatePage =
+ new RoutingReviewAndMoveToProductionPreviewLetterTemplatePage(page)
+ .setPathParam('messagePlanId', messagePlans.LETTER_ROUTING_CONFIG.id)
+ .setPathParam('templateId', templates.LETTER_WITHOUT_VARIANT.id);
+
+ await previewLetterTemplatePage.loadPage();
+
+ await expect(page).toHaveURL(`${baseURL}/templates/invalid-template`);
+ });
});
});
From 4a22f61bf632095c73847d43ff84728825261540 Mon Sep 17 00:00:00 2001
From: "alex.nuttall1"
Date: Thu, 9 Apr 2026 07:49:51 +0100
Subject: [PATCH 56/57] unit tests on missing variants
---
.../molecules/SummaryChooseLetter.test.tsx | 13 +++++++++++++
.../molecules/SummaryLetterFromMessagePlan.test.tsx | 13 +++++++++++++
2 files changed, 26 insertions(+)
diff --git a/frontend/src/__tests__/components/molecules/SummaryChooseLetter.test.tsx b/frontend/src/__tests__/components/molecules/SummaryChooseLetter.test.tsx
index 8bec9e9c0..2770f7e42 100644
--- a/frontend/src/__tests__/components/molecules/SummaryChooseLetter.test.tsx
+++ b/frontend/src/__tests__/components/molecules/SummaryChooseLetter.test.tsx
@@ -79,6 +79,19 @@ describe('SummaryChooseLetter', () => {
expect(redirectMock).toHaveBeenCalledWith('/invalid-template', 'replace');
});
+ it('should redirect to invalid-template when authoring letter template has no letterVariantId', async () => {
+ getTemplateMock.mockResolvedValueOnce({
+ ...AUTHORING_LETTER_TEMPLATE,
+ templateStatus: 'PROOF_APPROVED',
+ letterVariantId: undefined,
+ });
+
+ await SummaryChooseLetter(defaultProps);
+
+ expect(redirectMock).toHaveBeenCalledWith('/invalid-template', 'replace');
+ expect(getLetterVariantByIdMock).not.toHaveBeenCalled();
+ });
+
it('renders a letter template preview', async () => {
const letterVariant = makeLetterVariant();
diff --git a/frontend/src/__tests__/components/molecules/SummaryLetterFromMessagePlan.test.tsx b/frontend/src/__tests__/components/molecules/SummaryLetterFromMessagePlan.test.tsx
index d54ff53ca..0de7f5ce3 100644
--- a/frontend/src/__tests__/components/molecules/SummaryLetterFromMessagePlan.test.tsx
+++ b/frontend/src/__tests__/components/molecules/SummaryLetterFromMessagePlan.test.tsx
@@ -55,6 +55,19 @@ describe('SummaryLetterFromMessagePlan', () => {
expect(redirectMock).toHaveBeenCalledWith('/invalid-template', 'replace');
});
+ it('should redirect to invalid-template when authoring letter template has no letterVariantId', async () => {
+ getTemplateMock.mockResolvedValueOnce({
+ ...AUTHORING_LETTER_TEMPLATE,
+ templateStatus: 'SUBMITTED',
+ letterVariantId: undefined,
+ });
+
+ await SummaryLetterFromMessagePlan(defaultProps);
+
+ expect(redirectMock).toHaveBeenCalledWith('/invalid-template', 'replace');
+ expect(getLetterVariantByIdMock).not.toHaveBeenCalled();
+ });
+
it('renders an authoring letter template preview', async () => {
const letterVariant = makeLetterVariant();
From 8bfce13655fd5384f1e68d888deb282865a05b8c Mon Sep 17 00:00:00 2001
From: "alex.nuttall1"
Date: Thu, 9 Apr 2026 08:04:29 +0100
Subject: [PATCH 57/57] fmt
---
...-letter-template.routing-component.spec.ts | 28 +++++++++++--------
...-letter-template.routing-component.spec.ts | 28 +++++++++++--------
2 files changed, 32 insertions(+), 24 deletions(-)
diff --git a/tests/test-team/template-mgmt-routing-component-tests/letter/preview-large-print-letter-template.routing-component.spec.ts b/tests/test-team/template-mgmt-routing-component-tests/letter/preview-large-print-letter-template.routing-component.spec.ts
index 6a6079886..dc8dd60a6 100644
--- a/tests/test-team/template-mgmt-routing-component-tests/letter/preview-large-print-letter-template.routing-component.spec.ts
+++ b/tests/test-team/template-mgmt-routing-component-tests/letter/preview-large-print-letter-template.routing-component.spec.ts
@@ -69,17 +69,18 @@ function createTemplates(user: TestUser, letterVariant: LetterVariant) {
letterVariantId: letterVariant.id,
}
),
- LARGE_PRINT_LETTER_WITHOUT_VARIANT: TemplateFactory.createAuthoringLetterTemplate(
- templateIds.LARGE_PRINT_LETTER_WITHOUT_VARIANT,
- user,
- `Large print letter template no variant - ${templateIds.LARGE_PRINT_LETTER_WITHOUT_VARIANT}`,
- 'PROOF_APPROVED',
- {
- letterType: 'x1',
- shortFormRender: { status: 'RENDERED' },
- longFormRender: { status: 'RENDERED' },
- }
- ),
+ LARGE_PRINT_LETTER_WITHOUT_VARIANT:
+ TemplateFactory.createAuthoringLetterTemplate(
+ templateIds.LARGE_PRINT_LETTER_WITHOUT_VARIANT,
+ user,
+ `Large print letter template no variant - ${templateIds.LARGE_PRINT_LETTER_WITHOUT_VARIANT}`,
+ 'PROOF_APPROVED',
+ {
+ letterType: 'x1',
+ shortFormRender: { status: 'RENDERED' },
+ longFormRender: { status: 'RENDERED' },
+ }
+ ),
};
}
@@ -260,7 +261,10 @@ test.describe('Routing - Preview large print letter template page', () => {
await previewLargePrintLetterTemplatePage
.setPathParam('messagePlanId', messagePlans.LETTER_ROUTING_CONFIG.id)
- .setPathParam('templateId', templates.LARGE_PRINT_LETTER_WITHOUT_VARIANT.id)
+ .setPathParam(
+ 'templateId',
+ templates.LARGE_PRINT_LETTER_WITHOUT_VARIANT.id
+ )
.setSearchParam('lockNumber', '0')
.loadPage();
diff --git a/tests/test-team/template-mgmt-routing-component-tests/letter/preview-other-language-letter-template.routing-component.spec.ts b/tests/test-team/template-mgmt-routing-component-tests/letter/preview-other-language-letter-template.routing-component.spec.ts
index ac7500576..e172c91ff 100644
--- a/tests/test-team/template-mgmt-routing-component-tests/letter/preview-other-language-letter-template.routing-component.spec.ts
+++ b/tests/test-team/template-mgmt-routing-component-tests/letter/preview-other-language-letter-template.routing-component.spec.ts
@@ -69,17 +69,18 @@ function createTemplates(user: TestUser, letterVariant: LetterVariant) {
letterVariantId: letterVariant.id,
}
),
- FRENCH_LETTER_WITHOUT_VARIANT: TemplateFactory.createAuthoringLetterTemplate(
- templateIds.FRENCH_LETTER_WITHOUT_VARIANT,
- user,
- `French letter template no variant - ${templateIds.FRENCH_LETTER_WITHOUT_VARIANT}`,
- 'PROOF_APPROVED',
- {
- language: 'fr',
- shortFormRender: { status: 'RENDERED' },
- longFormRender: { status: 'RENDERED' },
- }
- ),
+ FRENCH_LETTER_WITHOUT_VARIANT:
+ TemplateFactory.createAuthoringLetterTemplate(
+ templateIds.FRENCH_LETTER_WITHOUT_VARIANT,
+ user,
+ `French letter template no variant - ${templateIds.FRENCH_LETTER_WITHOUT_VARIANT}`,
+ 'PROOF_APPROVED',
+ {
+ language: 'fr',
+ shortFormRender: { status: 'RENDERED' },
+ longFormRender: { status: 'RENDERED' },
+ }
+ ),
};
}
@@ -266,7 +267,10 @@ test.describe('Routing - Preview foreign language letter template page', () => {
const previewForeignLanguageLetterTemplatePage =
new RoutingPreviewOtherLanguageLetterTemplatePage(page)
.setPathParam('messagePlanId', messagePlans.LETTER_ROUTING_CONFIG.id)
- .setPathParam('templateId', templates.FRENCH_LETTER_WITHOUT_VARIANT.id)
+ .setPathParam(
+ 'templateId',
+ templates.FRENCH_LETTER_WITHOUT_VARIANT.id
+ )
.setSearchParam('lockNumber', '0');
await previewForeignLanguageLetterTemplatePage.loadPage();