Skip to content

Commit 685f27b

Browse files
committed
Squashed commit of the following:
commit 84b7536 Author: Alex Nuttall <[email protected]> Date: Fri May 30 08:45:53 2025 +0100 slight refactor of template details components commit 4d28811 Author: Alex Nuttall <[email protected]> Date: Fri May 30 08:35:31 2025 +0100 add proofs to letter submitted component test commit f30d688 Author: Alex Nuttall <[email protected]> Date: Fri May 30 08:32:40 2025 +0100 use a regular a tag + getBasePath commit aed6763 Author: Alex Nuttall <[email protected]> Date: Thu May 29 17:43:22 2025 +0100 use unique test IDs commit db3f50b Author: Alex Nuttall <[email protected]> Date: Thu May 29 17:02:33 2025 +0100 remove ref to nonexistant style commit 27b16c9 Author: Alex Nuttall <[email protected]> Date: Thu May 29 16:53:40 2025 +0100 disable function nesting rule for all tests commit 3548758 Author: Alex Nuttall <[email protected]> Date: Thu May 29 16:38:24 2025 +0100 rm types file commit e863059 Author: Alex Nuttall <[email protected]> Date: Thu May 29 16:22:13 2025 +0100 use default exports commit 7c92e4b Author: Alex Nuttall <[email protected]> Date: Thu May 29 15:39:27 2025 +0100 top left align file icon commit f76331c Author: Alex Nuttall <[email protected]> Date: Thu May 29 13:54:55 2025 +0100 stray change in template client commit 41e2a9e Author: Alex Nuttall <[email protected]> Date: Thu May 29 13:32:45 2025 +0100 fix unit tests commit 783d8ce Author: Alex Nuttall <[email protected]> Date: Thu May 29 13:29:59 2025 +0100 add e2e assertion commit bc19137 Author: Alex Nuttall <[email protected]> Date: Thu May 29 13:01:05 2025 +0100 fix e3e proofing test commit fb1487f Author: Alex Nuttall <[email protected]> Date: Thu May 29 12:37:40 2025 +0100 merge new amp util into existing access token util commit 3c710f1 Author: Alex Nuttall <[email protected]> Date: Thu May 29 12:09:20 2025 +0100 add test for getSubServer commit 34062db Author: Alex Nuttall <[email protected]> Date: Thu May 29 11:47:33 2025 +0100 get user in page instead commit 9032405 Author: Alex Nuttall <[email protected]> Date: Thu May 29 10:59:12 2025 +0100 css commit 1eca832 Author: Alex Nuttall <[email protected]> Date: Thu May 29 09:24:23 2025 +0100 add owner to dto commit bb60089 Author: Alex Nuttall <[email protected]> Date: Thu May 29 07:33:54 2025 +0100 rm context commit 4041b10 Author: Alex Nuttall <[email protected]> Date: Wed May 28 21:21:54 2025 +0100 context commit bce69eb Author: Alex Nuttall <[email protected]> Date: Wed May 28 09:29:57 2025 +0100 split component commit 8000d66 Author: Alex Nuttall <[email protected]> Date: Tue May 27 17:00:15 2025 +0100 add files to preview letter commit 5bc61c6 Author: Michael Harrison <[email protected]> Date: Thu May 29 11:08:18 2025 +0100 CCM-9874: tidy unused env var commit 5c1fb73 Merge: 3d2eb2a 14123cf Author: Michael Harrison <[email protected]> Date: Thu May 29 11:03:38 2025 +0100 Merge branch 'feature/CCM-9874-dl-edge-auth' of github.com:NHSDigital/nhs-notify-web-template-management into feature/CCM-9874-dl-edge-auth commit 3d2eb2a Author: Michael Harrison <[email protected]> Date: Thu May 29 11:02:14 2025 +0100 CCM-9874: default letter supplier name logic commit 14ce525 Merge: 26fbe63 488c8aa Author: Michael Harrison <[email protected]> Date: Thu May 29 11:00:47 2025 +0100 Merge branch 'main' into feature/CCM-9874-dl-edge-auth commit 14123cf Merge: 26fbe63 4f6857f Author: Michael Harrison <[email protected]> Date: Tue May 27 14:54:57 2025 +0100 Merge branch 'main' into feature/CCM-9874-dl-edge-auth commit 26fbe63 Author: Michael Harrison <[email protected]> Date: Fri May 23 11:07:33 2025 +0100 CCM-9874: review feedback commit d3985f2 Author: Michael Harrison <[email protected]> Date: Thu May 22 17:30:40 2025 +0100 CCM-9874: cookie casing commit 65908e9 Author: Michael Harrison <[email protected]> Date: Thu May 22 14:30:51 2025 +0100 CCM-9874: use managed cache policy commit ef0979c Merge: 493e9ad 29f7743 Author: Michael Harrison <[email protected]> Date: Thu May 22 14:26:20 2025 +0100 Merge branch 'main' into feature/CCM-9874-dl-edge-auth commit 493e9ad Author: Michael Harrison <[email protected]> Date: Wed May 21 12:15:45 2025 +0100 CCM-9874: restore pakcage lock fields commit e7b5b61 Author: Michael Harrison <[email protected]> Date: Tue May 20 14:56:59 2025 +0100 CCM-9874: fix key policy region commit 3133abf Author: Michael Harrison <[email protected]> Date: Tue May 20 14:33:20 2025 +0100 CCM-9874: fix conflict commit 87b3fda Merge: da9d6d7 c30f9f0 Author: Michael Harrison <[email protected]> Date: Tue May 20 12:12:58 2025 +0100 Merge branch 'main' into feature/CCM-9874-dl-edge-auth commit da9d6d7 Merge: 23e515d 25de238 Author: Michael Harrison <[email protected]> Date: Mon May 19 12:16:20 2025 +0100 Merge branch 'main' into feature/CCM-9874-dl-edge-auth commit 23e515d Merge: b1bdbba 9f1b533 Author: Michael Harrison <[email protected]> Date: Mon May 19 11:20:06 2025 +0100 Merge branch 'main' into feature/CCM-9874-dl-edge-auth commit b1bdbba Author: Michael Harrison <[email protected]> Date: Mon May 19 11:00:27 2025 +0100 CCM-9874: remove us-east-1 artifact bucket logging commit 5ac0e0b Author: Michael Harrison <[email protected]> Date: Mon May 19 08:45:48 2025 +0100 CCM-9874: us-east-1 resources for edge lambda commit 8dd02f6 Author: Alex Nuttall <[email protected]> Date: Thu May 15 08:24:54 2025 +0100 tf docs commit 7d81c08 Author: Alex Nuttall <[email protected]> Date: Thu May 15 08:12:24 2025 +0100 unhappy path unit tests commit 6d1fb55 Author: Alex Nuttall <[email protected]> Date: Wed May 14 19:13:43 2025 +0100 cleanup commit 81c55ad Author: Alex Nuttall <[email protected]> Date: Wed May 14 17:11:54 2025 +0100 try fix packaging commit 698b1a0 Author: Alex Nuttall <[email protected]> Date: Wed May 14 13:53:23 2025 +0100 try fix packaging commit 510d21c Author: Alex Nuttall <[email protected]> Date: Wed May 14 13:42:12 2025 +0100 try fix packaging commit 514a82a Author: Alex Nuttall <[email protected]> Date: Wed May 14 12:54:55 2025 +0100 try resolve circular dependency commit ea00d73 Author: Alex Nuttall <[email protected]> Date: Wed May 14 12:18:15 2025 +0100 back to shared lamdba mod, again commit 3ba4acc Author: Alex Nuttall <[email protected]> Date: Wed May 14 12:01:59 2025 +0100 add us-east provider commit b352062 Author: Alex Nuttall <[email protected]> Date: Wed May 14 11:11:38 2025 +0100 publish lambda version commit 74ebd3d Author: Alex Nuttall <[email protected]> Date: Wed May 14 10:32:54 2025 +0100 adding tests commit 29a394e Author: Alex Nuttall <[email protected]> Date: Tue May 13 20:36:08 2025 +0100 lambda_function_association commit c4068a6 Author: Alex Nuttall <[email protected]> Date: Tue May 13 20:07:45 2025 +0100 use qualified arn commit 2a333ac Author: Alex Nuttall <[email protected]> Date: Tue May 13 19:38:31 2025 +0100 fn assoc commit ba21c83 Author: Alex Nuttall <[email protected]> Date: Tue May 13 19:21:42 2025 +0100 fn assoc commit 9af8273 Author: Alex Nuttall <[email protected]> Date: Tue May 13 17:19:57 2025 +0100 csi scope cf policies commit 04e81ed Author: Alex Nuttall <[email protected]> Date: Tue May 13 17:03:19 2025 +0100 disable domain assoc deletion commit f2b37da Author: Alex Nuttall <[email protected]> Date: Tue May 13 16:50:38 2025 +0100 tf docs commit 933338f Author: Alex Nuttall <[email protected]> Date: Tue May 13 16:45:21 2025 +0100 revert to old lambda packaging commit be891c3 Author: Alex Nuttall <[email protected]> Date: Tue May 13 13:55:39 2025 +0100 dont do abspath twice commit c2e370d Author: Alex Nuttall <[email protected]> Date: Tue May 13 11:52:10 2025 +0100 whitespace commit e61d35d Author: Alex Nuttall <[email protected]> Date: Tue May 13 11:46:51 2025 +0100 fix whitespace in filename commit 27a9c4d Author: Alex Nuttall <[email protected]> Date: Tue May 13 11:39:40 2025 +0100 changes to allow use of lambda shared module commit d23d81d Author: Alex Nuttall <[email protected]> Date: Tue May 13 11:20:39 2025 +0100 newline commit aa15514 Author: Alex Nuttall <[email protected]> Date: Tue May 13 11:09:58 2025 +0100 restore VERSION file commit 6372a20 Author: Alex Nuttall <[email protected]> Date: Tue May 13 11:08:52 2025 +0100 cleanup commit a2b9def Author: Alex Nuttall <[email protected]> Date: Tue May 13 10:46:21 2025 +0100 rm sandbox parent acct env var commit a51dc83 Author: Alex Nuttall <[email protected]> Date: Tue May 13 10:14:46 2025 +0100 rm dup cdn commit 0ae5f59 Author: Alex Nuttall <[email protected]> Date: Tue May 13 10:13:47 2025 +0100 tf docs commit 3cfd81c Author: Alex Nuttall <[email protected]> Date: Mon May 12 07:29:07 2025 +0100 add try to env var which may be null commit 31641e5 Author: Alex Nuttall <[email protected]> Date: Fri May 9 17:43:09 2025 +0100 whitespace fix commit 24725d3 Author: Alex Nuttall <[email protected]> Date: Fri May 9 16:10:57 2025 +0100 add lambda commit fa47e9d Author: Alex Nuttall <[email protected]> Date: Fri May 9 15:31:44 2025 +0100 init commit ea90e44 Author: Alex Nuttall <[email protected]> Date: Mon May 12 13:02:36 2025 +0100 alphabetise commit d62acfa Author: Alex Nuttall <[email protected]> Date: Mon May 12 08:06:27 2025 +0100 fix duplicate output commit fafceba Author: ben.hansell1 <[email protected]> Date: Fri May 9 15:45:47 2025 +0100 CCM-9873: add access_logs bucket to acct outputs commit 766c8eb Author: ben.hansell1 <[email protected]> Date: Fri May 9 15:41:11 2025 +0100 CCM-9873: tf docs commit 7f4a65f Author: ben.hansell1 <[email protected]> Date: Fri May 9 11:29:03 2025 +0100 CCM-9873: move CDN to app component commit ba06f0b Author: Alex Nuttall <[email protected]> Date: Mon May 12 07:50:47 2025 +0100 init commit a36ba0a Author: Alex Nuttall <[email protected]> Date: Tue May 13 10:04:47 2025 +0100 tf docs commit d66adcd Author: Alex Nuttall <[email protected]> Date: Tue May 13 09:22:03 2025 +0100 rm second order bucket logging commit 18d9417 Author: Alex Nuttall <[email protected]> Date: Tue May 13 08:09:32 2025 +0100 cleanup commit d0859b5 Author: Alex Nuttall <[email protected]> Date: Tue May 13 08:06:50 2025 +0100 tf docs commit 3fc7ffd Author: Alex Nuttall <[email protected]> Date: Tue May 13 08:06:08 2025 +0100 naming commit c83cab6 Author: Alex Nuttall <[email protected]> Date: Mon May 12 21:02:06 2025 +0100 add acm validation commit 4fd9335 Author: Alex Nuttall <[email protected]> Date: Mon May 12 19:15:43 2025 +0100 try tf debug logging commit 766b0e5 Author: Alex Nuttall <[email protected]> Date: Mon May 12 17:10:20 2025 +0100 comment out bucket logging target commit 3a495da Author: Alex Nuttall <[email protected]> Date: Mon May 12 16:52:01 2025 +0100 fix ref to acct output commit 204866a Author: Alex Nuttall <[email protected]> Date: Mon May 12 16:29:48 2025 +0100 add s3 access logging commit bb52837 Author: Alex Nuttall <[email protected]> Date: Mon May 12 13:02:36 2025 +0100 alphabetise commit 4a4da40 Author: Alex Nuttall <[email protected]> Date: Mon May 12 11:26:40 2025 +0100 fix broken local ref commit ebdf7c8 Author: Alex Nuttall <[email protected]> Date: Mon May 12 11:20:54 2025 +0100 try dyn block commit 885394e Author: Alex Nuttall <[email protected]> Date: Mon May 12 10:55:22 2025 +0100 try foreach commit 6342f03 Author: Alex Nuttall <[email protected]> Date: Mon May 12 10:42:34 2025 +0100 fix local ref commit 2ac8c1f Author: Alex Nuttall <[email protected]> Date: Mon May 12 10:32:28 2025 +0100 construct bucket name outside mod commit 8541714 Author: Alex Nuttall <[email protected]> Date: Mon May 12 08:26:40 2025 +0100 fix ref to policy with count commit 4f9966b Author: Alex Nuttall <[email protected]> Date: Mon May 12 08:12:04 2025 +0100 add logging config to cdn commit 0b70a08 Author: Alex Nuttall <[email protected]> Date: Mon May 12 07:59:16 2025 +0100 rename dup file commit 7cda757 Author: Alex Nuttall <[email protected]> Date: Mon May 12 07:57:32 2025 +0100 upgrade tf module commit 47502f2 Author: Alex Nuttall <[email protected]> Date: Mon May 12 07:40:56 2025 +0100 add bucket policy optionally commit d699cab Author: ben.hansell1 <[email protected]> Date: Fri May 9 15:52:25 2025 +0100 CCM-9873: temporarily remove access log logging commit 73a77ef Author: ben.hansell1 <[email protected]> Date: Fri May 9 15:45:47 2025 +0100 CCM-9873: add access_logs bucket to acct outputs commit 2526753 Author: ben.hansell1 <[email protected]> Date: Fri May 9 15:41:11 2025 +0100 CCM-9873: tf docs commit ccedd2b Author: ben.hansell1 <[email protected]> Date: Fri May 9 15:35:03 2025 +0100 CCM-9873: remove last vestigates of having CDN in sandbox commit 50f801b Author: ben.hansell1 <[email protected]> Date: Fri May 9 15:31:10 2025 +0100 CCM-9873: toggle CDN. Add logging bucket for CDN access commit 0f268b2 Author: ben.hansell1 <[email protected]> Date: Fri May 9 12:40:17 2025 +0100 CCM-9873: remove WIP changes and previous backend-api changes commit 77eabf5 Author: ben.hansell1 <[email protected]> Date: Fri May 9 11:29:03 2025 +0100 CCM-9873: move CDN to app component commit 60531c4 Author: Alex Nuttall <[email protected]> Date: Mon May 12 08:03:35 2025 +0100 cleanup commit 99a2c22 Author: Alex Nuttall <[email protected]> Date: Wed May 7 09:11:51 2025 +0100 use js
1 parent 017bedd commit 685f27b

File tree

52 files changed

+1140
-489
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1140
-489
lines changed

.eslintrc.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,13 @@
8989
},
9090
{
9191
"files": [
92-
"*.test.{ts,tsx}"
92+
"*.{test,spec}.{ts,tsx}"
9393
],
9494
"rules": {
9595
"unicorn/no-useless-undefined": "off",
9696
"unicorn/consistent-function-scoping": "off",
97-
"max-classes-per-file": "off"
97+
"max-classes-per-file": "off",
98+
"sonarjs/no-nested-functions": "off"
9899
}
99100
}
100101
]

frontend/src/__tests__/components/forms/PreviewEmailTemplate/__snapshots__/PreviewEmailTemplate.test.tsx.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ exports[`Preview email form renders Client-side validation triggers 1`] = `
123123
</div>
124124
</dl>
125125
<dl
126-
class="nhsuk-summary-list preview"
126+
class="nhsuk-summary-list nhsuk-u-margin-bottom-4 preview"
127127
>
128128
<div
129129
class="nhsuk-summary-list__row"
@@ -412,7 +412,7 @@ exports[`Preview email form renders matches error snapshot 1`] = `
412412
</div>
413413
</dl>
414414
<dl
415-
class="nhsuk-summary-list preview"
415+
class="nhsuk-summary-list nhsuk-u-margin-bottom-4 preview"
416416
>
417417
<div
418418
class="nhsuk-summary-list__row"
@@ -674,7 +674,7 @@ exports[`Preview email form renders matches snapshot when navigating from edit s
674674
</div>
675675
</dl>
676676
<dl
677-
class="nhsuk-summary-list preview"
677+
class="nhsuk-summary-list nhsuk-u-margin-bottom-4 preview"
678678
>
679679
<div
680680
class="nhsuk-summary-list__row"
@@ -919,7 +919,7 @@ exports[`Preview email form renders matches snapshot when navigating from manage
919919
</div>
920920
</dl>
921921
<dl
922-
class="nhsuk-summary-list preview"
922+
class="nhsuk-summary-list nhsuk-u-margin-bottom-4 preview"
923923
>
924924
<div
925925
class="nhsuk-summary-list__row"

frontend/src/__tests__/components/forms/PreviewNHSAppTemplate/__snapshots__/PreviewNHSAppTemplate.test.tsx.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ exports[`Preview nhs app form renders Client-side validation triggers 1`] = `
123123
</div>
124124
</dl>
125125
<dl
126-
class="nhsuk-summary-list preview"
126+
class="nhsuk-summary-list nhsuk-u-margin-bottom-4 preview"
127127
>
128128
<div
129129
class="nhsuk-summary-list__row"
@@ -387,7 +387,7 @@ exports[`Preview nhs app form renders matches error snapshot 1`] = `
387387
</div>
388388
</dl>
389389
<dl
390-
class="nhsuk-summary-list preview"
390+
class="nhsuk-summary-list nhsuk-u-margin-bottom-4 preview"
391391
>
392392
<div
393393
class="nhsuk-summary-list__row"
@@ -624,7 +624,7 @@ exports[`Preview nhs app form renders matches snapshot when navigating from edit
624624
</div>
625625
</dl>
626626
<dl
627-
class="nhsuk-summary-list preview"
627+
class="nhsuk-summary-list nhsuk-u-margin-bottom-4 preview"
628628
>
629629
<div
630630
class="nhsuk-summary-list__row"
@@ -844,7 +844,7 @@ exports[`Preview nhs app form renders matches snapshot when navigating from mana
844844
</div>
845845
</dl>
846846
<dl
847-
class="nhsuk-summary-list preview"
847+
class="nhsuk-summary-list nhsuk-u-margin-bottom-4 preview"
848848
>
849849
<div
850850
class="nhsuk-summary-list__row"

frontend/src/__tests__/components/forms/PreviewSMSTemplate/__snapshots__/PreviewSMSTemplate.test.tsx.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ exports[`Review sms form renders Client-side validation triggers 1`] = `
123123
</div>
124124
</dl>
125125
<dl
126-
class="nhsuk-summary-list preview"
126+
class="nhsuk-summary-list nhsuk-u-margin-bottom-4 preview"
127127
>
128128
<div
129129
class="nhsuk-summary-list__row"
@@ -387,7 +387,7 @@ exports[`Review sms form renders matches error snapshot 1`] = `
387387
</div>
388388
</dl>
389389
<dl
390-
class="nhsuk-summary-list preview"
390+
class="nhsuk-summary-list nhsuk-u-margin-bottom-4 preview"
391391
>
392392
<div
393393
class="nhsuk-summary-list__row"
@@ -624,7 +624,7 @@ exports[`Review sms form renders matches snapshot when navigating from edit scre
624624
</div>
625625
</dl>
626626
<dl
627-
class="nhsuk-summary-list preview"
627+
class="nhsuk-summary-list nhsuk-u-margin-bottom-4 preview"
628628
>
629629
<div
630630
class="nhsuk-summary-list__row"
@@ -844,7 +844,7 @@ exports[`Review sms form renders matches snapshot when navigating from manage te
844844
</div>
845845
</dl>
846846
<dl
847-
class="nhsuk-summary-list preview"
847+
class="nhsuk-summary-list nhsuk-u-margin-bottom-4 preview"
848848
>
849849
<div
850850
class="nhsuk-summary-list__row"
Lines changed: 75 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
import { render, screen } from '@testing-library/react';
2-
import { PreviewTemplateDetails } from '@molecules/PreviewTemplateDetails';
1+
import PreviewTemplateDetailsEmail from '@molecules/PreviewTemplateDetails/PreviewTemplateDetailsEmail';
2+
import PreviewTemplateDetailsLetter from '@molecules/PreviewTemplateDetails/PreviewTemplateDetailsLetter';
3+
import PreviewTemplateDetailsNhsApp from '@molecules/PreviewTemplateDetails/PreviewTemplateDetailsNhsApp';
4+
import PreviewTemplateDetailsSms from '@molecules/PreviewTemplateDetails/PreviewTemplateDetailsSms';
5+
import { render } from '@testing-library/react';
36

4-
describe('PreviewTemplateDetails component', () => {
5-
it('matches not yet submitted snapshot', () => {
7+
describe('PreviewTemplateDetailsNhsApp', () => {
8+
it('matches snapshot', () => {
69
const container = render(
7-
<PreviewTemplateDetails
10+
<PreviewTemplateDetailsNhsApp
811
template={{
912
id: 'template-id',
1013
name: 'Example template',
@@ -14,53 +17,66 @@ describe('PreviewTemplateDetails component', () => {
1417
createdAt: '2025-01-13T10:19:25.579Z',
1518
updatedAt: '2025-01-13T10:19:25.579Z',
1619
}}
17-
templateTypeText='Channel template'
18-
contentPreview={[
19-
{
20-
heading: 'Heading',
21-
id: 'heading',
22-
value: 'Test value-1',
23-
},
24-
]}
20+
message='app content'
2521
/>
2622
);
2723

2824
expect(container.asFragment()).toMatchSnapshot();
2925
});
26+
});
3027

31-
it('matches submitted snapshot', () => {
28+
describe('PreviewTemplateDetailsEmail', () => {
29+
it('matches snapshot', () => {
3230
const container = render(
33-
<PreviewTemplateDetails
31+
<PreviewTemplateDetailsEmail
3432
template={{
3533
id: 'template-id',
36-
name: 'Example template',
34+
name: 'Example Email template',
35+
message: 'email message message',
36+
subject: 'subject',
37+
templateStatus: 'SUBMITTED',
38+
templateType: 'EMAIL',
39+
createdAt: '2025-01-13T10:19:25.579Z',
40+
updatedAt: '2025-01-13T10:19:25.579Z',
41+
}}
42+
message='email content'
43+
subject='email subject'
44+
/>
45+
);
46+
47+
expect(container.asFragment()).toMatchSnapshot();
48+
});
49+
});
50+
51+
describe('PreviewTemplateDetailsSms', () => {
52+
it('matches snapshot', () => {
53+
const container = render(
54+
<PreviewTemplateDetailsSms
55+
template={{
56+
id: 'template-id',
57+
name: 'SMS template',
58+
message: 'SMS message',
3759
templateStatus: 'SUBMITTED',
3860
templateType: 'SMS',
39-
message: 'text message message',
4061
createdAt: '2025-01-13T10:19:25.579Z',
4162
updatedAt: '2025-01-13T10:19:25.579Z',
4263
}}
43-
templateTypeText='Channel template'
44-
contentPreview={[
45-
{
46-
heading: 'Heading',
47-
id: 'heading',
48-
value: 'Test value-1',
49-
},
50-
]}
64+
message='SMS content'
5165
/>
5266
);
5367

5468
expect(container.asFragment()).toMatchSnapshot();
5569
});
70+
});
5671

57-
it('renders without content preview', () => {
72+
describe('PreviewTemplateDetailsLetter', () => {
73+
it('matches snapshot without proofs', () => {
5874
const container = render(
59-
<PreviewTemplateDetails
75+
<PreviewTemplateDetailsLetter
6076
template={{
6177
id: 'template-id',
6278
name: 'Example template',
63-
templateStatus: 'SUBMITTED',
79+
templateStatus: 'PENDING_VALIDATION',
6480
templateType: 'LETTER',
6581
letterType: 'x0',
6682
language: 'fr',
@@ -79,27 +95,19 @@ describe('PreviewTemplateDetails component', () => {
7995
createdAt: '2025-01-13T10:19:25.579Z',
8096
updatedAt: '2025-01-13T10:19:25.579Z',
8197
}}
82-
additionalMetaFields={[
83-
{
84-
title: 'Meta',
85-
id: 'meta',
86-
content: <p>metadata</p>,
87-
},
88-
]}
89-
templateTypeText='Channel template'
9098
/>
9199
);
92100

93101
expect(container.asFragment()).toMatchSnapshot();
94102
});
95103

96-
it('renders letter template when testDataCsv is not present', () => {
104+
it('matches snapshot when test data CSV is absent', () => {
97105
const container = render(
98-
<PreviewTemplateDetails.Letter
106+
<PreviewTemplateDetailsLetter
99107
template={{
100108
id: 'template-id',
101109
name: 'Example template',
102-
templateStatus: 'SUBMITTED',
110+
templateStatus: 'PENDING_VALIDATION',
103111
templateType: 'LETTER',
104112
letterType: 'x0',
105113
language: 'fr',
@@ -119,26 +127,31 @@ describe('PreviewTemplateDetails component', () => {
119127
expect(container.asFragment()).toMatchSnapshot();
120128
});
121129

122-
it('renders letter template when testPersonalisationInputFile is set', () => {
130+
it('matches snapshot when proofs are present, proofs failing virus scan are not displayed', () => {
123131
const container = render(
124-
<PreviewTemplateDetails.Letter
132+
<PreviewTemplateDetailsLetter
125133
template={{
126134
id: 'template-id',
127-
name: 'Example template',
128-
templateStatus: 'SUBMITTED',
135+
name: 'Example letter',
136+
templateStatus: 'PROOF_AVAILABLE',
129137
templateType: 'LETTER',
130138
letterType: 'x0',
131-
language: 'fr',
139+
language: 'en',
132140
files: {
133141
pdfTemplate: {
134142
fileName: 'file.pdf',
135143
currentVersion: '4C728B7D-A028-4BA2-B180-A63CDD2AE1E9',
136-
virusScanStatus: 'PENDING',
144+
virusScanStatus: 'PASSED',
137145
},
138146
testDataCsv: {
139147
fileName: 'file.csv',
140148
currentVersion: '622AB7FA-29BA-418A-B1B6-1E63FB299269',
141-
virusScanStatus: 'PENDING',
149+
virusScanStatus: 'PASSED',
150+
},
151+
proofs: {
152+
'a.pdf': { fileName: 'a.pdf', virusScanStatus: 'PASSED' },
153+
'b.pdf': { fileName: 'b.pdf', virusScanStatus: 'PASSED' },
154+
'c.pdf': { fileName: 'c.pdf', virusScanStatus: 'FAILED' },
142155
},
143156
},
144157
createdAt: '2025-01-13T10:19:25.579Z',
@@ -150,70 +163,29 @@ describe('PreviewTemplateDetails component', () => {
150163
expect(container.asFragment()).toMatchSnapshot();
151164
});
152165

153-
it('renders component correctly', () => {
154-
render(
155-
<PreviewTemplateDetails
166+
it('if status is PROOF_AVAILABLE, but no proofs are registered on the template, proof section is hidden (this is unexpected)', () => {
167+
const container = render(
168+
<PreviewTemplateDetailsLetter
156169
template={{
157170
id: 'template-id',
158-
name: 'Example template',
159-
message: 'app message message',
160-
templateType: 'NHS_APP',
161-
templateStatus: 'NOT_YET_SUBMITTED',
171+
name: 'Example letter',
172+
templateStatus: 'PROOF_AVAILABLE',
173+
templateType: 'LETTER',
174+
letterType: 'x0',
175+
language: 'en',
176+
files: {
177+
pdfTemplate: {
178+
fileName: 'file.pdf',
179+
currentVersion: '4C728B7D-A028-4BA2-B180-A63CDD2AE1E9',
180+
virusScanStatus: 'PASSED',
181+
},
182+
},
162183
createdAt: '2025-01-13T10:19:25.579Z',
163184
updatedAt: '2025-01-13T10:19:25.579Z',
164185
}}
165-
templateTypeText='Channel template'
166-
contentPreview={[
167-
{
168-
heading: 'Subject',
169-
id: 'subject',
170-
value: 'Subject value',
171-
},
172-
{
173-
heading: 'Heading',
174-
id: 'heading',
175-
value: 'Heading value',
176-
},
177-
{
178-
heading: 'Body text',
179-
id: 'body-text',
180-
value: 'Body text value',
181-
},
182-
{
183-
heading: 'Message',
184-
id: 'message',
185-
value: 'Message value',
186-
},
187-
]}
188186
/>
189187
);
190188

191-
expect(screen.getByTestId('preview-message__heading')).toHaveTextContent(
192-
'Example template'
193-
);
194-
expect(screen.getByTestId('preview__heading-0')).toHaveTextContent(
195-
'Subject'
196-
);
197-
expect(screen.getByTestId('preview__content-0')).toHaveTextContent(
198-
'Subject value'
199-
);
200-
expect(screen.getByTestId('preview__heading-1')).toHaveTextContent(
201-
'Heading'
202-
);
203-
expect(screen.getByTestId('preview__content-1')).toHaveTextContent(
204-
'Heading value'
205-
);
206-
expect(screen.getByTestId('preview__heading-2')).toHaveTextContent(
207-
'Body text'
208-
);
209-
expect(screen.getByTestId('preview__content-2')).toHaveTextContent(
210-
'Body text value'
211-
);
212-
expect(screen.getByTestId('preview__heading-3')).toHaveTextContent(
213-
'Message'
214-
);
215-
expect(screen.getByTestId('preview__content-3')).toHaveTextContent(
216-
'Message value'
217-
);
189+
expect(container.asFragment()).toMatchSnapshot();
218190
});
219191
});

0 commit comments

Comments
 (0)