Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
b380f87
CCM-11966: Change button text and TemplateStatus on frontend
m-salaudeen Oct 27, 2025
3bed181
CCM-11966: Refactor manage templates and SubmitLetterTemplate page to…
m-salaudeen Nov 13, 2025
78d4ede
CCM-11966: Refactor manage templates and SubmitLetterTemplate page to…
m-salaudeen Nov 13, 2025
14506d8
CCM-11966: Fix typecheck and unit test issues in piepline
m-salaudeen Nov 13, 2025
e54e4bf
CCM-11966: Add new status TEMPLATE_PROOF_APPROVED to spec template
m-salaudeen Nov 13, 2025
01f4b35
CCM-11966: Update SubmitTemplatePage component test
m-salaudeen Nov 13, 2025
907c296
CCM-11966: Feedback
m-salaudeen Nov 17, 2025
895bb77
CCM-11966: Feedback
m-salaudeen Nov 17, 2025
8fd6b8b
CCM-11966: Add Approve status to the backend
m-salaudeen Dec 16, 2025
c4a695a
CCM-11966: Fix unit test on template client
m-salaudeen Dec 18, 2025
b39c796
fix merge
m-salaudeen Dec 18, 2025
27984a0
CCM-11966: Fix typecheck issues
m-salaudeen Dec 18, 2025
7304f53
CCM-11966: Reduced the branch unit test coverage percentage
m-salaudeen Dec 18, 2025
556de3e
CCM-11966: Uncomment test coverage threshold
m-salaudeen Jan 8, 2026
419f231
CCM-11966: Merge conflicts
m-salaudeen Jan 14, 2026
24cc8e7
CCM-11966: Fixes from merge conflicts
m-salaudeen Jan 15, 2026
74fcd51
Merge remote-tracking branch 'origin/main' into feature/CCM-11966_app…
alexnuttall Jan 15, 2026
e85c4f4
rm unused test fixtures
alexnuttall Jan 15, 2026
c7cd264
coverage
alexnuttall Jan 15, 2026
deff47a
error on no template or client config
alexnuttall Jan 17, 2026
1b55fe0
test title
alexnuttall Jan 17, 2026
6768c19
coverage
alexnuttall Jan 17, 2026
f818e0e
template client / repo refactor
alexnuttall Jan 19, 2026
1937b1e
add to event schema
alexnuttall Jan 19, 2026
be15357
bump hey-api to resolve tar sve
alexnuttall Jan 19, 2026
20b05dc
increment event schema minor version
alexnuttall Jan 19, 2026
c965e9f
bump hey-api to resolve tar sve
alexnuttall Jan 19, 2026
8bf87c4
use patch version
alexnuttall Jan 19, 2026
416186d
regen deps
alexnuttall Jan 19, 2026
bf58ff1
Merge branch 'feature/CCM-11966-node-tar-cve' into feature/CCM-11966_…
alexnuttall Jan 19, 2026
4fb61b7
rename var
alexnuttall Jan 19, 2026
8b32811
Merge remote-tracking branch 'origin/main' into feature/CCM-11966_app…
alexnuttall Jan 19, 2026
17e8e0e
regen schemas
alexnuttall Jan 19, 2026
6452db1
status colour fix
alexnuttall Jan 19, 2026
8a232b0
Merge remote-tracking branch 'origin/main' into feature/CCM-11966_app…
alexnuttall Jan 19, 2026
99dbf5e
conditional page title
alexnuttall Jan 19, 2026
ce51a0e
api test
alexnuttall Jan 20, 2026
e8e9577
add client config permission
alexnuttall Jan 20, 2026
eb32362
add get template permission
alexnuttall Jan 20, 2026
d9898bf
Merge remote-tracking branch 'origin/main' into feature/CCM-11966_app…
alexnuttall Jan 21, 2026
7f33db3
new json schemas
alexnuttall Jan 21, 2026
53f4527
allow deletion of proof approved
alexnuttall Jan 21, 2026
9897197
redirect to message templates conditionally
alexnuttall Jan 21, 2026
a807bb4
events v 1.3.0
alexnuttall Jan 21, 2026
f02af66
api tests
alexnuttall Jan 21, 2026
5d5e7ce
Merge remote-tracking branch 'origin/main' into feature/CCM-11966_app…
alexnuttall Jan 21, 2026
d808bdc
init
alexnuttall Jan 22, 2026
e6a52f2
more unit tests
alexnuttall Jan 22, 2026
c3fd3f8
fix api test
alexnuttall Jan 22, 2026
3e484a0
Merge branch 'feature/CCM-11966_event-schema-string' into feature/CCM…
alexnuttall Jan 22, 2026
b72b530
empty commit
alexnuttall Jan 22, 2026
ab1c5fd
Merge branch 'feature/CCM-11966_event-schema-string' into feature/CCM…
alexnuttall Jan 22, 2026
5cb05f3
revert event schema package to main
alexnuttall Jan 22, 2026
d3a6a06
event tests
alexnuttall Jan 22, 2026
4b814fb
component tests
alexnuttall Jan 22, 2026
0a2e418
unused import
alexnuttall Jan 22, 2026
aa85995
stray log
alexnuttall Jan 22, 2026
b8916f8
use feature helper
alexnuttall Jan 22, 2026
4ec359b
Update tests/test-team/template-mgmt-event-tests/letter-templates.eve…
alexnuttall Jan 22, 2026
3be0cf7
update server feature unit test mock
alexnuttall Jan 22, 2026
be4dd1f
Merge remote-tracking branch 'origin/feature/CCM-11966_approve_and_su…
alexnuttall Jan 22, 2026
c19850b
improve test user naming in event test
alexnuttall Jan 22, 2026
79a7d1e
reject submission of non-letters
alexnuttall Jan 23, 2026
d0183a3
component test assertions
alexnuttall Jan 23, 2026
0776635
fix digital submission flows in component and event tests
alexnuttall Jan 23, 2026
7f16a01
revert rc schema changes
alexnuttall Jan 23, 2026
fa64384
Merge remote-tracking branch 'origin/main' into feature/CCM-11966_app…
alexnuttall Jan 23, 2026
d901d7b
lockfile
alexnuttall Jan 24, 2026
da7dc19
split template repo method approveProof
alexnuttall Jan 26, 2026
0e8b398
revert submit approve condition changes
alexnuttall Jan 26, 2026
ba9618b
fix routing disabled letter submission
alexnuttall Jan 26, 2026
5617f23
Merge remote-tracking branch 'origin/main' into feature/CCM-11966_app…
alexnuttall Jan 27, 2026
92e8cf0
rm status from template events
alexnuttall Jan 27, 2026
3cab107
event builder unit test
alexnuttall Jan 27, 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
24 changes: 22 additions & 2 deletions frontend/src/__tests__/app/submit-letter-template/page.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@ import {
SMS_TEMPLATE,
} from '@testhelpers/helpers';
import { LetterTemplate } from 'nhs-notify-web-template-management-utils';
import content from '@content/content';
import { serverIsFeatureEnabled } from '@utils/server-features';

jest.mock('@utils/form-actions');
jest.mock('next/navigation');
jest.mock('@forms/SubmitTemplate/SubmitLetterTemplate');
jest.mock('@utils/server-features');

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

describe('SubmitLetterTemplatePage', () => {
beforeEach(() => {
Expand Down Expand Up @@ -112,11 +116,27 @@ describe('SubmitLetterTemplatePage', () => {
);
});

test('should generate metadata', async () => {
test('should generate metadata with routing-enabled title when routing feature is enabled', async () => {
serverIsFeatureEnabledMock.mockResolvedValueOnce(true);

const metadata = await generateMetadata();

expect(metadata).toEqual({
title: content.pages.submitLetterTemplate.routingFlagEnabled.pageTitle,
});

expect(serverIsFeatureEnabledMock).toHaveBeenCalledWith('routing');
});

test('should generate metadata with routing-disabled title when routing feature is disabled', async () => {
serverIsFeatureEnabledMock.mockResolvedValueOnce(false);

const metadata = await generateMetadata();

expect(metadata).toEqual({
title: 'Submit letter template',
title: content.pages.submitLetterTemplate.routingFlagDisabled.pageTitle,
});

expect(serverIsFeatureEnabledMock).toHaveBeenCalledWith('routing');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jest.mock('@forms/SubmitTemplate/server-action', () => ({
jest.mock('@providers/client-config-provider');

describe('SubmitLetterTemplate component', () => {
it('should render', () => {
it('should render with client proofing enabled', () => {
jest.mocked(useFeatureFlags).mockReturnValueOnce({ proofing: true });

const container = render(
Expand All @@ -36,8 +36,24 @@ describe('SubmitLetterTemplate component', () => {
expect(container.asFragment()).toMatchSnapshot();
});

it('should render with client proofing disabled', () => {
jest.mocked(useFeatureFlags).mockReturnValueOnce({ proofing: false });
it('should render with client proofing and routing enabled', () => {
jest
.mocked(useFeatureFlags)
.mockReturnValueOnce({ proofing: true, routing: true });

const container = render(
<SubmitLetterTemplate
templateId='template-id'
templateName='template-name'
lockNumber={1234}
/>
);

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

it('should render with client proofing and routing disabled', () => {
jest.mocked(useFeatureFlags).mockReturnValueOnce({});

const container = render(
<SubmitLetterTemplate
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`SubmitLetterTemplate component should render 1`] = `
exports[`SubmitLetterTemplate component should render with client proofing and routing disabled 1`] = `
<DocumentFragment>
<main
class="nhsuk-main-wrapper"
Expand All @@ -14,17 +14,138 @@ exports[`SubmitLetterTemplate component should render 1`] = `
class="nhsuk-grid-column-two-thirds"
>
<h1>
Approve and submit 'template-name'
Submit 'template-name'
</h1>
<h2
class="nhsuk-heading-s"
>
Before you submit
</h2>
<p>
You should check that your template:
</p>
<ul
class="nhsuk-list nhsuk-list--bullet"
>
<li>
is approved by the relevant stakeholders in your team
</li>
<li>
does not have any spelling errors
</li>
<li>
is formatted correctly
</li>
</ul>
<h2
class="nhsuk-heading-s"
>
After you submit this template
</h2>
<p>
Our service team will send you a proof of this letter template by email.
</p>
<p>
This email will also tell you what you need to do next.
</p>
<div
class="nhsuk-warning-callout"
>
<h2
class="nhsuk-warning-callout__label"
>
<span
role="text"
>
<span
class="nhsuk-u-visually-hidden"
>
Important:
</span>
Important
</span>
</h2>
<p>
You cannot edit a template after you've submitted it. You can only replace it with a new template.
</p>
</div>
<form
action="/action"
>
<input
name="form-id"
readonly=""
type="hidden"
value="submit-template-form"
/>
<input
name="csrf_token"
readonly=""
type="hidden"
value="no_token"
/>
<input
name="templateId"
readonly=""
type="hidden"
value="template-id"
/>
<input
name="lockNumber"
readonly=""
type="hidden"
value="1234"
/>
<button
aria-disabled="false"
class="nhsuk-button nhsuk-u-margin-right-3"
id="submit-template-button"
type="submit"
>
Submit template
</button>
<a
aria-disabled="false"
class="nhsuk-button nhsuk-button--secondary"
data-testid="back-link-bottom"
draggable="false"
href="/templates/preview-letter-template/template-id"
role="button"
>
Go back
</a>
</form>
</div>
</div>
</main>
</DocumentFragment>
`;

exports[`SubmitLetterTemplate component should render with client proofing and routing enabled 1`] = `
<DocumentFragment>
<main
class="nhsuk-main-wrapper"
id="maincontent"
role="main"
>
<div
class="nhsuk-grid-row"
>
<div
class="nhsuk-grid-column-two-thirds"
>
<h1>
Approve 'template-name'
</h1>
<p
class="nhsuk-body-l"
>
When you submit a letter template, it will be used by NHS Notify to set up the messages you want to send.
When you approve your template proof, your template will be ready to add to a message plan.
</p>
<h2
class="nhsuk-heading-s"
>
Before you submit this template
Before you approve this template proof
</h2>
<p>
Check that your template proof:
Expand Down Expand Up @@ -60,7 +181,7 @@ exports[`SubmitLetterTemplate component should render 1`] = `
</span>
</h2>
<p>
You cannot edit a template after you've approved and submitted it. You can only replace it with a new template.
You cannot edit a template after you've approved the template proof. You can only create a new template to replace it.
</p>
</div>
<form
Expand Down Expand Up @@ -90,32 +211,33 @@ exports[`SubmitLetterTemplate component should render 1`] = `
type="hidden"
value="1234"
/>
<button
aria-disabled="false"
class="nhsuk-button nhsuk-u-margin-right-3"
id="submit-template-button"
type="submit"
>
Approve template proof
</button>
<a
aria-disabled="false"
class="nhsuk-button nhsuk-button--secondary nhsuk-u-margin-right-3"
class="nhsuk-button nhsuk-button--secondary"
data-testid="back-link-bottom"
draggable="false"
href="/templates/preview-letter-template/template-id"
id="go-back-button"
role="button"
>
Go back
</a>
<button
aria-disabled="false"
class="nhsuk-button"
id="submit-template-button"
type="submit"
>
Approve and submit
</button>
</form>
</div>
</div>
</main>
</DocumentFragment>
`;

exports[`SubmitLetterTemplate component should render with client proofing disabled 1`] = `
exports[`SubmitLetterTemplate component should render with client proofing enabled 1`] = `
<DocumentFragment>
<main
class="nhsuk-main-wrapper"
Expand All @@ -129,40 +251,34 @@ exports[`SubmitLetterTemplate component should render with client proofing disab
class="nhsuk-grid-column-two-thirds"
>
<h1>
Submit 'template-name'
Approve and submit 'template-name'
</h1>
<p
class="nhsuk-body-l"
>
When you submit a letter template, it will be used by NHS Notify to set up the messages you want to send.
</p>
<h2
class="nhsuk-heading-s"
>
Before you submit
Before you submit this template
</h2>
<p>
You should check that your template:
Check that your template proof:
</p>
<ul
class="nhsuk-list nhsuk-list--bullet"
>
<li>
is approved by the relevant stakeholders in your team
looks exactly as you expect your recipient to get it
</li>
<li>
does not have any spelling errors
uses personalisation as you expect
</li>
<li>
is formatted correctly
shows QR codes correctly (if used)
</li>
</ul>
<h2
class="nhsuk-heading-s"
>
After you submit this template
</h2>
<p>
Our service team will send you a proof of this letter template by email.
</p>
<p>
This email will also tell you what you need to do next.
</p>
<div
class="nhsuk-warning-callout"
>
Expand All @@ -181,7 +297,7 @@ exports[`SubmitLetterTemplate component should render with client proofing disab
</span>
</h2>
<p>
You cannot edit a template after you've submitted it. You can only replace it with a new template.
You cannot edit a template after you've approved and submitted it. You can only replace it with a new template.
</p>
</div>
<form
Expand Down Expand Up @@ -211,24 +327,25 @@ exports[`SubmitLetterTemplate component should render with client proofing disab
type="hidden"
value="1234"
/>
<button
aria-disabled="false"
class="nhsuk-button nhsuk-u-margin-right-3"
id="submit-template-button"
type="submit"
>
Approve and submit
</button>
<a
aria-disabled="false"
class="nhsuk-button nhsuk-button--secondary nhsuk-u-margin-right-3"
class="nhsuk-button nhsuk-button--secondary"
data-testid="back-link-bottom"
draggable="false"
href="/templates/preview-letter-template/template-id"
id="go-back-button"
role="button"
>
Go back
</a>
<button
aria-disabled="false"
class="nhsuk-button"
id="submit-template-button"
type="submit"
>
Submit template
</button>
</form>
</div>
</div>
Expand Down
Loading