Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
0a2dd87
CCM-15018: update message-callout content based on feature flags
bhansell1 Mar 16, 2026
0fdd300
CCM-15018: add tests
bhansell1 Mar 16, 2026
274b1d8
CCM-15018: add page to accessibility route coverage
bhansell1 Mar 17, 2026
31a35c2
CCM-15018: add link for approve letter proofs
bhansell1 Mar 17, 2026
eca9c8e
CCM-15018: content
bhansell1 Mar 18, 2026
01d0f85
Merge branch 'main' of https://github.com/NHSDigital/nhs-notify-web-t…
bhansell1 Mar 18, 2026
554b035
trivvy
bhansell1 Mar 18, 2026
7200475
CCM-15018: remove channelSlug
bhansell1 Mar 18, 2026
9d5947d
CCM-15018: lockfile mismatch
bhansell1 Mar 18, 2026
ebc2e92
CCM-15018: content
bhansell1 Mar 20, 2026
23f29b4
CCM-15018: refactor page to show RequestProof banner on the page when…
bhansell1 Mar 23, 2026
eacdac4
WIP: ebc2e9226 CCM-15018: content
bhansell1 Mar 23, 2026
94c4eef
CCM-15018: update automated tests and URL
bhansell1 Mar 23, 2026
c918e29
Merge branch 'main' of https://github.com/NHSDigital/nhs-notify-web-t…
bhansell1 Mar 24, 2026
6bdd8b9
CCM-15018: refactor show banner one or the other banner version regar…
bhansell1 Mar 24, 2026
c201aae
CCM-15018: update message-tempplates digital preview automated tests
bhansell1 Mar 24, 2026
4877dc4
CCM-15018: add automated tests for banners on message-plan template p…
bhansell1 Mar 25, 2026
c904f5f
Merge branch 'main' of https://github.com/NHSDigital/nhs-notify-web-t…
bhansell1 Mar 25, 2026
c50f76c
typecheck
bhansell1 Mar 25, 2026
838a3b0
CCM-15018: add additional tests covering preview
bhansell1 Apr 1, 2026
bef1c38
Merge branch 'main' of https://github.com/NHSDigital/nhs-notify-web-t…
bhansell1 Apr 1, 2026
8d2f732
CCM-15018: fix merge conflicts
bhansell1 Apr 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,24 @@ exports[`PreviewEmailTemplateFromMessagePlan page renders Email template preview
</div>
</dl>
</div>
<div
class="nhsuk-summary-list message-banner"
>
<div
class="nhs_notify_warning_callout nhsuk-u-padding-4 nhsuk-u-margin-bottom-6 nhsuk-u-reading-width message-banner__callout"
data-testid="request-proof-message-banner"
>
This is only a basic preview.
<a
href="/templates/request-a-proof/email-template-id"
rel=""
target=""
>
Request a proof
</a>
to preview this template properly.
</div>
</div>
<a
class="nhsuk-link nhsuk-body-m nhsuk-u-display-inline-block"
data-testid="back-link-bottom"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,24 @@ exports[`PreviewNhsAppTemplateFromMessagePlan page renders NHS App template prev
</div>
</dl>
</div>
<div
class="nhsuk-summary-list message-banner"
>
<div
class="nhs_notify_warning_callout nhsuk-u-padding-4 nhsuk-u-margin-bottom-6 nhsuk-u-reading-width message-banner__callout"
data-testid="request-proof-message-banner"
>
This is only a basic preview.
<a
href="/templates/request-a-proof/app-template-id"
rel=""
target=""
>
Request a proof
</a>
to preview this template properly.
</div>
</div>
<a
class="nhsuk-link nhsuk-body-m nhsuk-u-display-inline-block"
data-testid="back-link-bottom"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,24 @@ exports[`PreviewTextMessageTemplateFromMessagePlan page renders SMS template pre
</div>
</dl>
</div>
<div
class="nhsuk-summary-list message-banner"
>
<div
class="nhs_notify_warning_callout nhsuk-u-padding-4 nhsuk-u-margin-bottom-6 nhsuk-u-reading-width message-banner__callout"
data-testid="request-proof-message-banner"
>
This is only a basic preview.
<a
href="/templates/request-a-proof/sms-template-id"
rel=""
target=""
>
Request a proof
</a>
to preview this template properly.
</div>
</div>
<a
class="nhsuk-link nhsuk-body-m nhsuk-u-display-inline-block"
data-testid="back-link-bottom"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`RequestADigitalProofPage matches snapshot 1`] = `
<DocumentFragment>
<div
class="nhsuk-width-container"
>
<a
class="nhsuk-back-link"
data-testid="back-link-top"
href="/preview-nhs-app-template/app-template-id"
>
Back to template
</a>
<main
class="nhsuk-main-wrapper"
id="maincontent"
role="main"
>
<div
class="nhsuk-grid-row"
>
<div
class="nhsuk-grid-column-two-thirds"
>
<h1
id="request-a-proof"
>
Request a proof
</h1>
<p>
You must request and approve proofs of your templates before you add them to a message plan.
</p>
<p>
This ensures we send your messages exactly as you expect your recipients to get them.
</p>
<h2
class="nhsuk-heading-m"
id="before-you-start"
>
Before you start
</h2>
<p>
Only request proofs once your templates are final.
</p>
<p>
You can request proofs for one template or a group of templates in a campaign.
</p>
<p>
Find out more about how to
<a
href="https://notify.nhs.uk/using-nhs-notify/approve-your-messages"
rel="noopener noreferrer"
target="_blank"
>
approve your messages (opens in a new tab)
</a>
.
</p>
<p
class="nhsuk-inset-text"
>
This process is for NHS App messages, emails and text messages only. Find out
<a
href="https://notify.nhs.uk/using-nhs-notify/approve-your-messages#requesting-letter-proofs"
rel="noopener noreferrer"
target="_blank"
>
how to approve letter templates (opens in a new tab)
</a>
.
</p>
<h2
class="nhsuk-heading-m"
id="how-to-request-a-proof"
>
How to request a proof
</h2>
<p>
You'll need:
</p>
<ul>
<li>
the template ID or IDs
</li>
<li>
the email address you want the proofs sent to
</li>
<li>
your service name
</li>
<li>
the campaign name, if you have one
</li>
</ul>
<p>
<a
href="https://nhsdigitallive.service-now.com/csm"
rel="noopener noreferrer"
target="_blank"
>
Request a proof using ServiceNow (opens in a new tab)
</a>
.
</p>
</div>
</div>
</main>
</div>
</DocumentFragment>
`;
100 changes: 100 additions & 0 deletions frontend/src/__tests__/app/request-a-proof/page.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import RequestADigitalProofPage, {
generateMetadata,
} from '@app/request-a-proof/[templateId]/page';
import { render, screen } from '@testing-library/react';
import pageContent from '@content/content';
import { redirect } from 'next/navigation';
import { getTemplate } from '@utils/form-actions';
import {
EMAIL_TEMPLATE,
NHS_APP_TEMPLATE,
PDF_LETTER_TEMPLATE,
SMS_TEMPLATE,
} from '@testhelpers/helpers';

jest.mock('@utils/form-actions');
jest.mock('next/navigation');

const getTemplateMock = jest.mocked(getTemplate);
const redirectMock = jest.mocked(redirect);

const { pageTitle, backLink } =
pageContent.components.howToRequestADigitalProof;

describe('RequestADigitalProofPage', () => {
beforeEach(() => {
jest.resetAllMocks();
});

it('matches snapshot', async () => {
getTemplateMock.mockResolvedValueOnce(NHS_APP_TEMPLATE);

const page = render(
await RequestADigitalProofPage({
params: Promise.resolve({
templateId: 'template-id',
}),
})
);

expect(page.asFragment()).toMatchSnapshot();
});

it('should return metadata', async () => {
expect(await generateMetadata()).toEqual({
title: pageTitle,
});
});

test.each([
['nhs-app', NHS_APP_TEMPLATE],
['text-message', SMS_TEMPLATE],
['email', EMAIL_TEMPLATE],
])(
'should render page for %s template type with expected back link',
async (channelSlug, template) => {
getTemplateMock.mockResolvedValueOnce(template);

render(
await RequestADigitalProofPage({
params: Promise.resolve({
templateId: template.id,
}),
})
);

expect(getTemplateMock).toHaveBeenCalledWith(template.id);

const backLinkElement = screen.getByRole('link', { name: backLink.text });

expect(backLinkElement).toHaveAttribute(
'href',
`/preview-${channelSlug}-template/${template.id}`
);
}
);

it('should redirect to message templates when no template is found', async () => {
getTemplateMock.mockResolvedValueOnce(undefined);

await RequestADigitalProofPage({
params: Promise.resolve({
templateId: 'template-id',
}),
});

expect(redirectMock).toHaveBeenCalledWith('/message-templates');
});

it('should redirect to message templates when template type is LETTER', async () => {
getTemplateMock.mockResolvedValueOnce(PDF_LETTER_TEMPLATE);

await RequestADigitalProofPage({
params: Promise.resolve({
templateId: 'template-id',
}),
});

expect(redirectMock).toHaveBeenCalledWith('/message-templates');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -216,4 +216,32 @@ describe('Preview email form renders', () => {
'Rendered via MD'
);
});

describe('digitalProofingEmail enabled', () => {
beforeEach(() => {
jest
.mocked(useFeatureFlags)
.mockReturnValue({ digitalProofingEmail: true });
});

it('matches snapshot', () => {
const container = render(
<PreviewEmailTemplate
initialState={mockDeep<TemplateFormState<EmailTemplate>>({
errorState: undefined,
name: 'test-template-email',
templateStatus: 'NOT_YET_SUBMITTED',
templateType: 'EMAIL',
subject: 'template-subject-line',
message: 'message',
id: 'template-id',
})}
/>
);

expect(screen.getByTestId('test-message-banner')).toBeInTheDocument();

expect(container.asFragment()).toMatchSnapshot();
});
});
});
Loading
Loading