Skip to content

Commit f7fc805

Browse files
test ssh-sign
1 parent a752225 commit f7fc805

1 file changed

Lines changed: 6 additions & 16 deletions

File tree

tests/component-tests/apiGateway-tests/get-letter-pdf.spec.ts

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ test.describe("API Gateway Tests to Verify Get Letter PDF Endpoint", () => {
3838
);
3939

4040
expect(response.status()).toBe(200);
41-
// const responseBody = await response.text();
42-
// expect(responseBody).toContain("PDF");
41+
const responseBody = await response.text();
42+
expect(responseBody).toContain("PDF");
4343

44-
async function fetchAndValidatePdf(url: string) {
44+
async function fetchUrl(url: string) {
4545
const res = await request.get(url, { headers });
4646
return {
4747
status: res.status(),
@@ -59,23 +59,13 @@ test.describe("API Gateway Tests to Verify Get Letter PDF Endpoint", () => {
5959
const expiresSeconds = Number(expiresParam);
6060
expect(Number.isFinite(expiresSeconds)).toBeTruthy();
6161

62-
// Validate the URL works immediately
63-
const url = await fetchAndValidatePdf(pdfUrl);
64-
expect(url.status).toBe(200);
65-
expect(url.headers["content-type"] || "").toContain("application/pdf");
66-
6762
const waitMs = Math.max(expiresSeconds * 1000 + 2000, 0);
68-
if (waitMs > 0) {
69-
// Cap wait to avoid extremely long waits
70-
const MAX_WAIT_MS = 120_000; // 2 minutes cap
71-
const effectiveWait = Math.min(waitMs, MAX_WAIT_MS);
7263
await new Promise((resolve) => {
73-
setTimeout(resolve, effectiveWait);
64+
setTimeout(resolve, waitMs);
7465
});
7566

76-
const after = await fetchAndValidatePdf(pdfUrl);
77-
expect([400, 403]).toContain(after.status);
78-
}
67+
const after = await fetchUrl(pdfUrl);
68+
expect (after.status).toBe(403);
7969
});
8070

8171
test(`Get /letters/{id}/data returns 404 if no resource is found for id`, async ({

0 commit comments

Comments
 (0)