Skip to content

Commit 8d3da0d

Browse files
committed
CCM012327: update missed event requests
1 parent 2c7b5d6 commit 8d3da0d

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

tests/test-team/template-mgmt-event-tests/letter-templates.event.spec.ts

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { readFileSync } from 'node:fs';
1212
import { SftpHelper } from '../helpers/sftp/sftp-helper';
1313
import { InvokeCommand, LambdaClient } from '@aws-sdk/client-lambda';
1414
import { setTimeout } from 'node:timers/promises';
15+
import { Template } from 'helpers/types';
1516

1617
test.describe('Event publishing - Letters', () => {
1718
const authHelper = createAuthHelper();
@@ -117,18 +118,18 @@ test.describe('Event publishing - Letters', () => {
117118
}) => {
118119
const templateId = randomUUID();
119120

120-
await templateStorageHelper.seedTemplateData([
121-
{
122-
...TemplateFactory.uploadLetterTemplate(
123-
templateId,
124-
userProofingEnabled,
125-
'userProofingEnabledTemplate',
126-
'PENDING_PROOF_REQUEST'
127-
),
128-
// the values in this array do not matter at this point
129-
personalisationParameters: ['nhsNumber'],
130-
},
131-
]);
121+
const template = {
122+
...TemplateFactory.uploadLetterTemplate(
123+
templateId,
124+
userProofingEnabled,
125+
'userProofingEnabledTemplate',
126+
'PENDING_PROOF_REQUEST'
127+
),
128+
// the values in this array do not matter at this point
129+
personalisationParameters: ['nhsNumber'],
130+
};
131+
132+
await templateStorageHelper.seedTemplateData([template]);
132133

133134
const start = new Date();
134135

@@ -162,6 +163,7 @@ test.describe('Event publishing - Letters', () => {
162163
{
163164
headers: {
164165
Authorization: await userProofingEnabled.getAccessToken(),
166+
'X-Lock-Number': String(template.lockNumber),
165167
},
166168
}
167169
);
@@ -177,20 +179,23 @@ test.describe('Event publishing - Letters', () => {
177179
})
178180
);
179181

182+
let latest: Template = template;
183+
180184
await expect(async () => {
181-
const template = await templateStorageHelper.getTemplate({
185+
latest = await templateStorageHelper.getTemplate({
182186
templateId,
183187
clientId: userProofingEnabled.clientId,
184188
});
185189

186-
expect(template.templateStatus).toBe('PROOF_AVAILABLE');
190+
expect(latest.templateStatus).toBe('PROOF_AVAILABLE');
187191
}).toPass({ timeout: 15_000, intervals: [1000, 3000, 5000] });
188192

189193
const submitResponse = await request.patch(
190194
`${process.env.API_BASE_URL}/v1/template/${templateId}/submit`,
191195
{
192196
headers: {
193197
Authorization: await userProofingEnabled.getAccessToken(),
198+
'X-Lock-Number': String(latest.lockNumber),
194199
},
195200
}
196201
);

0 commit comments

Comments
 (0)