Skip to content

Commit 23d4c4f

Browse files
committed
CCM-11492 Update fallback conditions copy
1 parent 3c0ce6b commit 23d4c4f

File tree

9 files changed

+108
-59
lines changed

9 files changed

+108
-59
lines changed

frontend/src/__tests__/app/choose-templates/__snapshots__/page.test.tsx.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ exports[`ChooseTemplatesPage renders correctly for a message plan with multiple
371371
style="color: transparent;"
372372
width="34"
373373
/>
374-
If first message read within 24 hours, no further messages sent.
374+
If second message delivered within 72 hours, no further messages sent.
375375
</li>
376376
<li>
377377
<img
@@ -386,7 +386,7 @@ exports[`ChooseTemplatesPage renders correctly for a message plan with multiple
386386
style="color: transparent;"
387387
width="34"
388388
/>
389-
If first message not read within 24 hours, second message sent.
389+
If second message not delivered within 72 hours, third message sent.
390390
</li>
391391
</ul>
392392
</div>
@@ -509,7 +509,7 @@ exports[`ChooseTemplatesPage renders correctly for a message plan with multiple
509509
style="color: transparent;"
510510
width="34"
511511
/>
512-
If first message read within 24 hours, no further messages sent.
512+
If third message delivered within 72 hours, no further messages sent.
513513
</li>
514514
<li>
515515
<img
@@ -524,7 +524,7 @@ exports[`ChooseTemplatesPage renders correctly for a message plan with multiple
524524
style="color: transparent;"
525525
width="34"
526526
/>
527-
If first message not read within 24 hours, second message sent.
527+
If third message not delivered within 72 hours, fourth message sent.
528528
</li>
529529
</ul>
530530
</div>

frontend/src/__tests__/components/molecules/MessagePlanFallbackConditions.test.tsx

Lines changed: 46 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1+
import { Channel } from 'nhs-notify-backend-client';
12
import React from 'react';
2-
import { render, within } from '@testing-library/react';
3+
import { render, screen, within } from '@testing-library/react';
34
import userEvent from '@testing-library/user-event';
45
import { MessagePlanFallbackConditions } from '@molecules/MessagePlanFallbackConditions/MessagePlanFallbackConditions';
56

67
describe('MessagePlanFallbackConditions', () => {
78
it('should render the title and list items for a digital channel', () => {
89
const { container } = render(
9-
<MessagePlanFallbackConditions channel='NHSAPP' />
10+
<MessagePlanFallbackConditions channel='NHSAPP' index={0} />
1011
);
1112

1213
const details = container.querySelector('details')!;
@@ -41,7 +42,7 @@ describe('MessagePlanFallbackConditions', () => {
4142
it('should toggle details open/closed when clicking the summary', async () => {
4243
const user = userEvent.setup();
4344
const { container } = render(
44-
<MessagePlanFallbackConditions channel='EMAIL' />
45+
<MessagePlanFallbackConditions channel='EMAIL' index={0} />
4546
);
4647

4748
const details = container.querySelector('details')!;
@@ -58,7 +59,7 @@ describe('MessagePlanFallbackConditions', () => {
5859

5960
it('should render correct title and only the continue item for letter channel', () => {
6061
const { container } = render(
61-
<MessagePlanFallbackConditions channel='LETTER' />
62+
<MessagePlanFallbackConditions channel='LETTER' index={0} />
6263
);
6364

6465
const details = container.querySelector('details')!;
@@ -98,13 +99,45 @@ describe('MessagePlanFallbackConditions', () => {
9899
]);
99100
});
100101

101-
it.each(['NHSAPP', 'EMAIL', 'SMS', 'LETTER'] as const)(
102-
'should match snapshot for %s',
103-
(channel) => {
104-
const { asFragment } = render(
105-
<MessagePlanFallbackConditions channel={channel} />
106-
);
107-
expect(asFragment()).toMatchSnapshot();
108-
}
109-
);
102+
it('renders correct ordinals at different indexes', async () => {
103+
render(
104+
<>
105+
<MessagePlanFallbackConditions channel='NHSAPP' index={0} />
106+
<MessagePlanFallbackConditions channel='NHSAPP' index={1} />
107+
</>
108+
);
109+
110+
const [firstInstance, secondInstance] = screen.getAllByTestId(
111+
'message-plan-fallback-conditions-NHSAPP'
112+
);
113+
114+
const firstInstanceListItems = within(
115+
within(firstInstance.querySelector('details')!).getByRole('list')
116+
).getAllByRole('listitem');
117+
expect(firstInstanceListItems[1].textContent).toBe(
118+
'If first message not read within 24 hours, second message sent.'
119+
);
120+
121+
const secondInstanceListItems = within(
122+
within(secondInstance.querySelector('details')!).getByRole('list')
123+
).getAllByRole('listitem');
124+
expect(secondInstanceListItems[1].textContent).toBe(
125+
'If second message not read within 24 hours, third message sent.'
126+
);
127+
});
128+
129+
it.each([
130+
['NHSAPP', 0],
131+
['EMAIL', 1],
132+
['SMS', 2],
133+
['LETTER', 3],
134+
])('should match snapshot for %s at index %i', (channel, index) => {
135+
const { asFragment } = render(
136+
<MessagePlanFallbackConditions
137+
channel={channel as Channel}
138+
index={index}
139+
/>
140+
);
141+
expect(asFragment()).toMatchSnapshot();
142+
});
110143
});

frontend/src/__tests__/components/molecules/__snapshots__/MessagePlanFallbackConditions.test.tsx.snap

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`MessagePlanFallbackConditions should match snapshot for EMAIL 1`] = `
3+
exports[`MessagePlanFallbackConditions should match snapshot for EMAIL at index 1 1`] = `
44
<DocumentFragment>
55
<li
66
class="fallback-conditions"
@@ -70,7 +70,7 @@ exports[`MessagePlanFallbackConditions should match snapshot for EMAIL 1`] = `
7070
style="color: transparent;"
7171
width="34"
7272
/>
73-
If first message read within 24 hours, no further messages sent.
73+
If second message delivered within 72 hours, no further messages sent.
7474
</li>
7575
<li>
7676
<img
@@ -85,7 +85,7 @@ exports[`MessagePlanFallbackConditions should match snapshot for EMAIL 1`] = `
8585
style="color: transparent;"
8686
width="34"
8787
/>
88-
If first message not read within 24 hours, second message sent.
88+
If second message not delivered within 72 hours, third message sent.
8989
</li>
9090
</ul>
9191
</div>
@@ -94,7 +94,7 @@ exports[`MessagePlanFallbackConditions should match snapshot for EMAIL 1`] = `
9494
</DocumentFragment>
9595
`;
9696

97-
exports[`MessagePlanFallbackConditions should match snapshot for LETTER 1`] = `
97+
exports[`MessagePlanFallbackConditions should match snapshot for LETTER at index 3 1`] = `
9898
<DocumentFragment>
9999
<li
100100
class="fallback-conditions"
@@ -181,7 +181,7 @@ exports[`MessagePlanFallbackConditions should match snapshot for LETTER 1`] = `
181181
</DocumentFragment>
182182
`;
183183

184-
exports[`MessagePlanFallbackConditions should match snapshot for NHSAPP 1`] = `
184+
exports[`MessagePlanFallbackConditions should match snapshot for NHSAPP at index 0 1`] = `
185185
<DocumentFragment>
186186
<li
187187
class="fallback-conditions"
@@ -275,7 +275,7 @@ exports[`MessagePlanFallbackConditions should match snapshot for NHSAPP 1`] = `
275275
</DocumentFragment>
276276
`;
277277

278-
exports[`MessagePlanFallbackConditions should match snapshot for SMS 1`] = `
278+
exports[`MessagePlanFallbackConditions should match snapshot for SMS at index 2 1`] = `
279279
<DocumentFragment>
280280
<li
281281
class="fallback-conditions"
@@ -345,7 +345,7 @@ exports[`MessagePlanFallbackConditions should match snapshot for SMS 1`] = `
345345
style="color: transparent;"
346346
width="34"
347347
/>
348-
If first message read within 24 hours, no further messages sent.
348+
If third message delivered within 72 hours, no further messages sent.
349349
</li>
350350
<li>
351351
<img
@@ -360,7 +360,7 @@ exports[`MessagePlanFallbackConditions should match snapshot for SMS 1`] = `
360360
style="color: transparent;"
361361
width="34"
362362
/>
363-
If first message not read within 24 hours, second message sent.
363+
If third message not delivered within 72 hours, fourth message sent.
364364
</li>
365365
</ul>
366366
</div>

frontend/src/__tests__/components/organisms/CreateEditMessagePlan.test.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@ import {
1212
LETTER_TEMPLATE,
1313
NHS_APP_TEMPLATE,
1414
} from '@testhelpers/helpers';
15-
import { randomUUID } from 'node:crypto';
1615

1716
const mockTemplates: MessagePlanTemplates = {} as MessagePlanTemplates;
1817

1918
function buildRoutingConfig({
20-
id = randomUUID(),
19+
id = '30fd1e1c-a608-47cf-9cc2-eabaeeeebeca',
2120
name = 'Test Campaign',
2221
status = 'DRAFT' as RoutingConfigStatus,
2322
channels = ['NHSAPP', 'EMAIL'] as Channel[],

frontend/src/__tests__/components/organisms/__snapshots__/CreateEditMessagePlan.test.tsx.snap

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ exports[`CreateEditMessagePlan should match snapshot for a typical message plan
2828
>
2929
<a
3030
data-testid="change-message-plan-name-link"
31-
href="/message-plans/edit-message-plan/1a1b029a-248b-4e68-9b91-fe1079f2ae8b"
31+
href="/message-plans/edit-message-plan/30fd1e1c-a608-47cf-9cc2-eabaeeeebeca"
3232
>
3333
Change name
3434
</a>
@@ -47,7 +47,7 @@ exports[`CreateEditMessagePlan should match snapshot for a typical message plan
4747
<dd
4848
class="nhsuk-summary-list__value create-edit-message-plan-routing-config-id"
4949
>
50-
1a1b029a-248b-4e68-9b91-fe1079f2ae8b
50+
30fd1e1c-a608-47cf-9cc2-eabaeeeebeca
5151
</dd>
5252
</div>
5353
<div
@@ -105,7 +105,7 @@ exports[`CreateEditMessagePlan should match snapshot for a typical message plan
105105
<a
106106
class="nhsuk-link nhsuk-link--no-visited-state"
107107
data-testid="choose-template-link-NHSAPP"
108-
href="/message-plans/choose-nhs-app-template/1a1b029a-248b-4e68-9b91-fe1079f2ae8b"
108+
href="/message-plans/choose-nhs-app-template/30fd1e1c-a608-47cf-9cc2-eabaeeeebeca"
109109
>
110110
Choose
111111
<span
@@ -242,7 +242,7 @@ exports[`CreateEditMessagePlan should match snapshot for a typical message plan
242242
<a
243243
class="nhsuk-link nhsuk-link--no-visited-state"
244244
data-testid="choose-template-link-SMS"
245-
href="/message-plans/choose-text-message-template/1a1b029a-248b-4e68-9b91-fe1079f2ae8b"
245+
href="/message-plans/choose-text-message-template/30fd1e1c-a608-47cf-9cc2-eabaeeeebeca"
246246
>
247247
Choose
248248
<span
@@ -325,7 +325,7 @@ exports[`CreateEditMessagePlan should match snapshot for a typical message plan
325325
style="color: transparent;"
326326
width="34"
327327
/>
328-
If first message read within 24 hours, no further messages sent.
328+
If second message delivered within 72 hours, no further messages sent.
329329
</li>
330330
<li>
331331
<img
@@ -340,7 +340,7 @@ exports[`CreateEditMessagePlan should match snapshot for a typical message plan
340340
style="color: transparent;"
341341
width="34"
342342
/>
343-
If first message not read within 24 hours, second message sent.
343+
If second message not delivered within 72 hours, third message sent.
344344
</li>
345345
</ul>
346346
</div>
@@ -379,7 +379,7 @@ exports[`CreateEditMessagePlan should match snapshot for a typical message plan
379379
<a
380380
class="nhsuk-link nhsuk-link--no-visited-state"
381381
data-testid="choose-template-link-EMAIL"
382-
href="/message-plans/choose-email-template/1a1b029a-248b-4e68-9b91-fe1079f2ae8b"
382+
href="/message-plans/choose-email-template/30fd1e1c-a608-47cf-9cc2-eabaeeeebeca"
383383
>
384384
Choose
385385
<span
@@ -462,7 +462,7 @@ exports[`CreateEditMessagePlan should match snapshot for a typical message plan
462462
style="color: transparent;"
463463
width="34"
464464
/>
465-
If first message read within 24 hours, no further messages sent.
465+
If third message delivered within 72 hours, no further messages sent.
466466
</li>
467467
<li>
468468
<img
@@ -477,7 +477,7 @@ exports[`CreateEditMessagePlan should match snapshot for a typical message plan
477477
style="color: transparent;"
478478
width="34"
479479
/>
480-
If first message not read within 24 hours, second message sent.
480+
If third message not delivered within 72 hours, fourth message sent.
481481
</li>
482482
</ul>
483483
</div>
@@ -516,7 +516,7 @@ exports[`CreateEditMessagePlan should match snapshot for a typical message plan
516516
<a
517517
class="nhsuk-link nhsuk-link--no-visited-state"
518518
data-testid="choose-template-link-LETTER"
519-
href="/message-plans/choose-standard-english-letter-template/1a1b029a-248b-4e68-9b91-fe1079f2ae8b"
519+
href="/message-plans/choose-standard-english-letter-template/30fd1e1c-a608-47cf-9cc2-eabaeeeebeca"
520520
>
521521
Choose
522522
<span
@@ -541,7 +541,7 @@ exports[`CreateEditMessagePlan should match snapshot for a typical message plan
541541
class="nhsuk-button"
542542
data-testid="move-to-production-cta"
543543
draggable="false"
544-
href="/message-plans/move-to-production/1a1b029a-248b-4e68-9b91-fe1079f2ae8b"
544+
href="/message-plans/move-to-production/30fd1e1c-a608-47cf-9cc2-eabaeeeebeca"
545545
role="button"
546546
>
547547
Move to production
@@ -591,7 +591,7 @@ exports[`CreateEditMessagePlan should match snapshot for a typical message plan
591591
>
592592
<a
593593
data-testid="change-message-plan-name-link"
594-
href="/message-plans/edit-message-plan/135dcd77-ad2e-4c9f-91c3-10ca593abf67"
594+
href="/message-plans/edit-message-plan/30fd1e1c-a608-47cf-9cc2-eabaeeeebeca"
595595
>
596596
Change name
597597
</a>
@@ -610,7 +610,7 @@ exports[`CreateEditMessagePlan should match snapshot for a typical message plan
610610
<dd
611611
class="nhsuk-summary-list__value create-edit-message-plan-routing-config-id"
612612
>
613-
135dcd77-ad2e-4c9f-91c3-10ca593abf67
613+
30fd1e1c-a608-47cf-9cc2-eabaeeeebeca
614614
</dd>
615615
</div>
616616
<div
@@ -674,7 +674,7 @@ exports[`CreateEditMessagePlan should match snapshot for a typical message plan
674674
<a
675675
class="nhsuk-link nhsuk-link--no-visited-state"
676676
data-testid="change-template-link-NHSAPP"
677-
href="/message-plans/choose-nhs-app-template/135dcd77-ad2e-4c9f-91c3-10ca593abf67"
677+
href="/message-plans/choose-nhs-app-template/30fd1e1c-a608-47cf-9cc2-eabaeeeebeca"
678678
>
679679
Change
680680
<span
@@ -832,7 +832,7 @@ exports[`CreateEditMessagePlan should match snapshot for a typical message plan
832832
<a
833833
class="nhsuk-link nhsuk-link--no-visited-state"
834834
data-testid="change-template-link-EMAIL"
835-
href="/message-plans/choose-email-template/135dcd77-ad2e-4c9f-91c3-10ca593abf67"
835+
href="/message-plans/choose-email-template/30fd1e1c-a608-47cf-9cc2-eabaeeeebeca"
836836
>
837837
Change
838838
<span
@@ -930,7 +930,7 @@ exports[`CreateEditMessagePlan should match snapshot for a typical message plan
930930
style="color: transparent;"
931931
width="34"
932932
/>
933-
If first message read within 24 hours, no further messages sent.
933+
If second message delivered within 72 hours, no further messages sent.
934934
</li>
935935
<li>
936936
<img
@@ -945,7 +945,7 @@ exports[`CreateEditMessagePlan should match snapshot for a typical message plan
945945
style="color: transparent;"
946946
width="34"
947947
/>
948-
If first message not read within 24 hours, second message sent.
948+
If second message not delivered within 72 hours, third message sent.
949949
</li>
950950
</ul>
951951
</div>
@@ -990,7 +990,7 @@ exports[`CreateEditMessagePlan should match snapshot for a typical message plan
990990
<a
991991
class="nhsuk-link nhsuk-link--no-visited-state"
992992
data-testid="change-template-link-LETTER"
993-
href="/message-plans/choose-standard-english-letter-template/135dcd77-ad2e-4c9f-91c3-10ca593abf67"
993+
href="/message-plans/choose-standard-english-letter-template/30fd1e1c-a608-47cf-9cc2-eabaeeeebeca"
994994
>
995995
Change
996996
<span
@@ -1030,7 +1030,7 @@ exports[`CreateEditMessagePlan should match snapshot for a typical message plan
10301030
class="nhsuk-button"
10311031
data-testid="move-to-production-cta"
10321032
draggable="false"
1033-
href="/message-plans/move-to-production/135dcd77-ad2e-4c9f-91c3-10ca593abf67"
1033+
href="/message-plans/move-to-production/30fd1e1c-a608-47cf-9cc2-eabaeeeebeca"
10341034
role="button"
10351035
>
10361036
Move to production

0 commit comments

Comments
 (0)