Skip to content

Commit 85efcec

Browse files
committed
add hash in more test data
1 parent 3db34c7 commit 85efcec

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

scripts/utilities/letter-test-data/src/cli/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,21 +192,22 @@ async function main() {
192192
const letterRepository = createLetterRepository(environment, ttlHours);
193193
const { count } = argv;
194194
const { testLetter } = argv;
195-
196195
// Setup file attributes
197196
const bucketName = `nhs-${argv.awsAccountId}-eu-west-2-${argv.environment}-supapi-test-letters`;
198197
const targetFilename = `${batchId}-${status}.pdf`;
199198
const folder = `${supplierId}/${batchId}`;
200199
const url = `s3://${bucketName}/${folder}/${targetFilename}`;
200+
let hash: string | undefined;
201201

202202
// Upload a test file for this batch if it is not an 'none' batch
203203
if (testLetter !== "none") {
204-
await uploadFile(
204+
const result = await uploadFile(
205205
bucketName,
206-
folder,
206+
supplierId,
207207
`${testLetter}.pdf`,
208208
targetFilename,
209209
);
210+
hash = result.hash;
210211
}
211212

212213
// Create letter DTOs
@@ -221,6 +222,7 @@ async function main() {
221222
billingId,
222223
status: status as LetterStatusType,
223224
url,
225+
sha256Hash: hash,
224226
}),
225227
);
226228
}

scripts/utilities/letter-test-data/src/helpers/create-letter-helpers.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export function createLetterDto(params: {
6969
groupId: string;
7070
status: LetterStatusType;
7171
url: string;
72+
sha256Hash?: string;
7273
}) {
7374
const {
7475
billingId,
@@ -78,6 +79,7 @@ export function createLetterDto(params: {
7879
status,
7980
supplierId,
8081
url,
82+
sha256Hash,
8183
} = params;
8284

8385
const letter: Omit<Letter, "ttl" | "supplierStatus" | "supplierStatusSk"> = {

0 commit comments

Comments
 (0)