Skip to content

Commit f012342

Browse files
committed
add download bucket assertion
1 parent 7eda0d2 commit f012342

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

tests/test-team/template-mgmt-e2e-tests/template-mgmt-letter-full.e2e.spec.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,27 @@ test.describe('letter complete e2e journey', () => {
181181
);
182182

183183
expect(pdfHrefs.length).toBeGreaterThan(0);
184-
185184
for (const href of pdfHrefs) expect(href).toContain(templateId);
186185

186+
const downloadBucketMetadata = await Promise.all(
187+
pdfHrefs.map((href) => {
188+
const [downloadBucketPath] =
189+
(href as string).match(
190+
// eslint-disable-next-line security/detect-unsafe-regex, sonarjs/slow-regex
191+
/((?:[^/]+\/){3}[^/]+)\/?$/
192+
) ?? [];
193+
194+
return templateStorageHelper.getS3Metadata(
195+
process.env.TEMPLATES_DOWNLOAD_BUCKET_NAME,
196+
downloadBucketPath!
197+
);
198+
})
199+
);
200+
201+
for (const [i, entry] of downloadBucketMetadata.entries()) {
202+
expect(entry, JSON.stringify(pdfHrefs[i])).not.toBeNull();
203+
}
204+
187205
await previewTemplatePage.clickContinueButton();
188206
}).toPass({ timeout: 60_000 });
189207

0 commit comments

Comments
 (0)