Skip to content

Commit 24b752b

Browse files
fix tests
1 parent e2d59e9 commit 24b752b

2 files changed

Lines changed: 7 additions & 27 deletions

File tree

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

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ import {
77
SUPPLIER_LETTERS,
88
} from "../../constants/api-constants";
99
import { createValidRequestHeaders } from "../../constants/request-headers";
10-
import {
11-
error404ResponseBody,
12-
error500ResponseBody,
13-
} from "../../helpers/common-types";
10+
import { error404ResponseBody } from "../../helpers/common-types";
1411

1512
let baseUrl: string;
1613

@@ -84,7 +81,7 @@ test.describe("API Gateway Tests to Verify Get Letter PDF Endpoint", () => {
8481
});
8582

8683
// CCM-14318: Remove this test
87-
test(`Get /letters/{id}/data returns 500 if letter is not found for supplierId ${SUPPLIERID}`, async ({
84+
test(`Get /letters/{id}/data returns 404 if letter is not found for supplierId ${SUPPLIERID}`, async ({
8885
request,
8986
}) => {
9087
const id = "non-existing-id-12345";
@@ -98,7 +95,7 @@ test.describe("API Gateway Tests to Verify Get Letter PDF Endpoint", () => {
9895
);
9996

10097
const responseBody = await response.json();
101-
expect(response.status()).toBe(500);
102-
expect(responseBody).toMatchObject(error500ResponseBody());
98+
expect(response.status()).toBe(404);
99+
expect(responseBody).toMatchObject(error404ResponseBody());
103100
});
104101
});

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

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@ import getRestApiGatewayBaseUrl from "../../helpers/aws-gateway-helper";
33
import { getLettersBySupplier } from "../../helpers/generate-fetch-test-data";
44
import { SUPPLIERID, SUPPLIER_LETTERS } from "../../constants/api-constants";
55
import { createValidRequestHeaders } from "../../constants/request-headers";
6-
import {
7-
error404ResponseBody,
8-
error500ResponseBody,
9-
} from "../../helpers/common-types";
6+
import { error404ResponseBody } from "../../helpers/common-types";
107

118
let baseUrl: string;
129

@@ -49,10 +46,10 @@ test.describe("API Gateway Tests to Verify Get Letter Status Endpoint", () => {
4946
});
5047
});
5148

52-
test(`Get /letters/{id} returns 404 if no resource is found for id`, async ({
49+
test(`Get /letters/{id} returns 404 if letter is not found for supplierId ${SUPPLIERID}`, async ({
5350
request,
5451
}) => {
55-
const id = "11";
52+
const id = "non-existing-id-12345";
5653
const headers = createValidRequestHeaders();
5754
const response = await request.get(`${baseUrl}/${SUPPLIER_LETTERS}/${id}`, {
5855
headers,
@@ -62,18 +59,4 @@ test.describe("API Gateway Tests to Verify Get Letter Status Endpoint", () => {
6259
expect(response.status()).toBe(404);
6360
expect(responseBody).toMatchObject(error404ResponseBody());
6461
});
65-
66-
test(`Get /letters/{id} returns 500 if letter is not found for supplierId ${SUPPLIERID}`, async ({
67-
request,
68-
}) => {
69-
const id = "non-existing-id-12345";
70-
const headers = createValidRequestHeaders();
71-
const response = await request.get(`${baseUrl}/${SUPPLIER_LETTERS}/${id}`, {
72-
headers,
73-
});
74-
75-
const responseBody = await response.json();
76-
expect(response.status()).toBe(500);
77-
expect(responseBody).toMatchObject(error500ResponseBody());
78-
});
7962
});

0 commit comments

Comments
 (0)