Skip to content

Commit 8859031

Browse files
committed
CCM-14974: Add failure codes to PrintLetterTransitioned events in component tests
1 parent 5435af2 commit 8859031

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

tests/playwright/digital-letters-component-tests/report-generator.component.spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,20 +86,26 @@ const scenarios = [
8686
[EventStatus.Rejected],
8787
'Rejected',
8888
senderId,
89+
'API_CODE_001',
90+
'The letter was rejected.',
8991
),
9092
new ReportScenario(
9193
'component-test-failed',
9294
CommunicationType.Print,
9395
[EventStatus.Failed],
9496
'Failed',
9597
senderId,
98+
'API_CODE_002',
99+
'Letter processing failed',
96100
),
97101
new ReportScenario(
98102
'component-test-returned',
99103
CommunicationType.Print,
100104
[EventStatus.Returned],
101105
'Returned',
102106
senderId,
107+
'API_CODE_003',
108+
'The letter was returned',
103109
),
104110
new ReportScenario(
105111
'component-test-dispatched',

tests/playwright/helpers/event-builders.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ export function buildPrintLetterTransitionedEvent(
7070
messageReference: string,
7171
status: string,
7272
senderId: string,
73+
reasonCode: string,
74+
reasonText: string,
7375
): PrintLetterTransitioned {
7476
const baseEvent = buildBaseEvent('print', time);
7577
return {
@@ -84,6 +86,8 @@ export function buildPrintLetterTransitionedEvent(
8486
status,
8587
supplierId: 'supplier-1',
8688
time,
89+
reasonCode,
90+
reasonText,
8791
},
8892
} as PrintLetterTransitioned;
8993
}

tests/playwright/helpers/report-helpers.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,8 @@ export function publishEventForScenario(scenario: ReportScenario) {
228228
scenario.messageReference,
229229
status,
230230
scenario.senderId,
231+
scenario.expectedReasonCode,
232+
scenario.expectedReason,
231233
),
232234
],
233235
printLetterTransitionedValidator,

0 commit comments

Comments
 (0)