Skip to content

Commit f25a9c8

Browse files
committed
rename personalisationFields to ...Parameters
1 parent 86f0de9 commit f25a9c8

File tree

5 files changed

+38
-26
lines changed

5 files changed

+38
-26
lines changed

lambdas/sftp-letters/src/__tests__/app/__snapshots__/send.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ exports[`App throws if proof request event is missing a property 1`] = `
77
"expected": "array",
88
"received": "undefined",
99
"path": [
10-
"personalisationFields"
10+
"personalisationParameters"
1111
],
1212
"message": "Required"
1313
}

lambdas/sftp-letters/src/__tests__/app/send.test.ts

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,25 +48,29 @@ function setup() {
4848

4949
function mockEvent(
5050
hasTestData: boolean,
51-
personalisationFields: string[]
51+
personalisationParameters: string[]
5252
): ProofingRequest {
5353
return {
5454
owner,
5555
templateId,
5656
pdfVersion,
5757
...(hasTestData && { testDataVersion }),
58-
personalisationFields,
58+
personalisationParameters,
5959
};
6060
}
6161

6262
describe('App', () => {
6363
test('calls dependencies to send a proofing request', async () => {
6464
const { app, mocks } = setup();
6565

66-
const personalisationFields = ['pdsField', 'custom1', 'custom2'];
67-
const batchColumns = ['clientRef', 'template', ...personalisationFields];
66+
const personalisationParameters = ['pdsField', 'custom1', 'custom2'];
67+
const batchColumns = [
68+
'clientRef',
69+
'template',
70+
...personalisationParameters,
71+
];
6872

69-
const event = mockEvent(true, personalisationFields);
73+
const event = mockEvent(true, personalisationParameters);
7074

7175
const pdfContent = 'mock PDF content';
7276
const pdf = Readable.from(pdfContent);
@@ -172,13 +176,13 @@ describe('App', () => {
172176
expect(mocks.syntheticBatch.buildBatch).toHaveBeenCalledTimes(1);
173177
expect(mocks.syntheticBatch.buildBatch).toHaveBeenCalledWith(
174178
templateId,
175-
personalisationFields,
179+
personalisationParameters,
176180
testData
177181
);
178182

179183
expect(mocks.syntheticBatch.getHeader).toHaveBeenCalledTimes(1);
180184
expect(mocks.syntheticBatch.getHeader).toHaveBeenCalledWith(
181-
personalisationFields
185+
personalisationParameters
182186
);
183187

184188
expect(mocks.syntheticBatch.buildManifest).toHaveBeenCalledTimes(1);
@@ -253,7 +257,7 @@ describe('App', () => {
253257
test('throws if proof request event is missing a property', async () => {
254258
const { app, mocks } = setup();
255259

256-
const { personalisationFields: _, ...invalidEvent } = mockEvent(true, [
260+
const { personalisationParameters: _, ...invalidEvent } = mockEvent(true, [
257261
'field',
258262
]);
259263

@@ -270,10 +274,14 @@ describe('App', () => {
270274
test('exits early and does not send if a lock is already in effect', async () => {
271275
const { app, mocks, logMessages } = setup();
272276

273-
const personalisationFields = ['pdsField'];
274-
const batchColumns = ['clientRef', 'template', ...personalisationFields];
277+
const personalisationParameters = ['pdsField'];
278+
const batchColumns = [
279+
'clientRef',
280+
'template',
281+
...personalisationParameters,
282+
];
275283

276-
const event = mockEvent(true, personalisationFields);
284+
const event = mockEvent(true, personalisationParameters);
277285

278286
const pdfContent = 'mock PDF content';
279287
const pdf = Readable.from(pdfContent);
@@ -353,10 +361,14 @@ describe('App', () => {
353361
test('exits early and does not send if the manifest is already in the SFTP server, clears existing lock', async () => {
354362
const { app, mocks, logMessages } = setup();
355363

356-
const personalisationFields = ['pdsField'];
357-
const batchColumns = ['clientRef', 'template', ...personalisationFields];
364+
const personalisationParameters = ['pdsField'];
365+
const batchColumns = [
366+
'clientRef',
367+
'template',
368+
...personalisationParameters,
369+
];
358370

359-
const event = mockEvent(true, personalisationFields);
371+
const event = mockEvent(true, personalisationParameters);
360372

361373
const pdfContent = 'mock PDF content';
362374
const pdf = Readable.from(pdfContent);
@@ -443,9 +455,9 @@ describe('App', () => {
443455
test('logs handled errors', async () => {
444456
const { app, mocks, logMessages } = setup();
445457

446-
const personalisationFields = ['pdsField', 'custom1', 'custom2'];
458+
const personalisationParameters = ['pdsField', 'custom1', 'custom2'];
447459

448-
const event = mockEvent(true, personalisationFields);
460+
const event = mockEvent(true, personalisationParameters);
449461

450462
const batchId = 'template-id-0000000000000_pdfversionid';
451463

lambdas/sftp-letters/src/app/send.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class App {
2929
templateId,
3030
pdfVersion,
3131
testDataVersion,
32-
personalisationFields,
32+
personalisationParameters,
3333
} = this.parseProofingRequest(eventBody);
3434

3535
const batchId = this.batch.getId(templateId, pdfVersion);
@@ -53,7 +53,7 @@ export class App {
5353
templateId,
5454
pdfVersion,
5555
testDataVersion,
56-
personalisationFields,
56+
personalisationParameters,
5757
batchId
5858
);
5959

@@ -118,7 +118,7 @@ export class App {
118118
templateId: z.string(),
119119
pdfVersion: z.string(),
120120
testDataVersion: z.string().optional(),
121-
personalisationFields: z.array(z.string()),
121+
personalisationParameters: z.array(z.string()),
122122
})
123123
.parse(JSON.parse(event));
124124
}

lambdas/sftp-letters/src/infra/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ export type ProofingRequest = {
1212
templateId: string;
1313
pdfVersion: string;
1414
testDataVersion?: string;
15-
personalisationFields: string[];
15+
personalisationParameters: string[];
1616
};

tests/test-team/template-mgmt-e2e-tests/template-mgmt-sftp-send-proof.e2e.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ test.describe('SFTP proof send', () => {
5050
test('Sends PDF and test batch to SFTP, updates template @debug', async () => {
5151
const templateId = randomUUID();
5252

53-
const personalisationFields = [
53+
const personalisationParameters = [
5454
'date',
5555
'nhsNumber',
5656
'fullName',
@@ -74,11 +74,11 @@ test.describe('SFTP proof send', () => {
7474
'send-proof-letter',
7575
'PASSED'
7676
),
77-
// The status PENDING_PROOF_REQUEST doesn't exist yet
78-
// the template's 'personalisationFields' has no effect on the test
77+
// The status PENDING_PROOF doesn't exist yet
78+
// the template's 'personalisationParameters' has no effect on the test
7979
// the sender lambda does not read the template
8080
templateStatus: 'PENDING_PROOF',
81-
personalisationFields,
81+
personalisationParameters,
8282
};
8383

8484
const key = {
@@ -108,7 +108,7 @@ test.describe('SFTP proof send', () => {
108108
owner: key.owner,
109109
pdfVersion,
110110
testDataVersion: csvVersion,
111-
personalisationFields,
111+
personalisationParameters,
112112
};
113113

114114
await sqsHelper.sendMessage(process.env.SEND_PROOF_QUEUE_URL, proofRequest);

0 commit comments

Comments
 (0)