Skip to content

Commit b8be2e9

Browse files
add dependencies
1 parent 30672a2 commit b8be2e9

2 files changed

Lines changed: 24 additions & 1 deletion

File tree

tests/component-tests/integration-tests/urgent-letter-priority.spec.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { test } from "@playwright/test";
1+
import { expect, test } from "@playwright/test";
22
import getRestApiGatewayBaseUrl from "tests/helpers/aws-gateway-helper";
33
import { pollForLetterStatus } from "tests/helpers/poll-for-letters-helper";
44
import { getLettersFromQueueViaIndex } from "tests/helpers/generate-fetch-test-data";
@@ -9,6 +9,12 @@ import {
99
verifyAllocationLogsContainPriority,
1010
verifyIndexPositionOfLetterVariants,
1111
} from "tests/helpers/urgent-letter-priority-helper";
12+
import { createValidRequestHeaders } from "tests/constants/request-headers";
13+
import { SUPPLIER_LETTERS } from "tests/constants/api-constants";
14+
import {
15+
GetLettersResponse,
16+
GetLettersResponseSchema,
17+
} from "../../../lambdas/api-handler/src/contracts/letters";
1218

1319
let baseUrl: string;
1420

@@ -42,6 +48,21 @@ test.describe("Urgent Letter Priority Tests", () => {
4248
(letter) => letter.letterId,
4349
);
4450

51+
const header = createValidRequestHeaders(supplier);
52+
const response = await request.get(`${baseUrl}/${SUPPLIER_LETTERS}`, {
53+
headers: header,
54+
});
55+
56+
expect(response.status()).toBe(200);
57+
const responseBody = await response.json();
58+
expect(responseBody.data.length).toBeGreaterThanOrEqual(1);
59+
60+
const getLettersResponse: GetLettersResponse =
61+
GetLettersResponseSchema.parse(responseBody);
62+
63+
const letterIds = getLettersResponse.data.map((letter) => letter.id);
64+
expect(letterIds).toEqual(letterIdsFromQueue);
65+
4566
verifyIndexPositionOfLetterVariants(
4667
letterIdsFromQueue,
4768
urgencyTenLetterIds,

tests/config/main.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const localConfig: PlaywrightTestConfig = {
1313
name: "apiGateway-tests",
1414
testDir: path.resolve(__dirname, "../component-tests/apiGateway-tests"),
1515
testMatch: "**/*.spec.ts",
16+
dependencies: ["integration-tests"],
1617
},
1718
{
1819
name: "events-tests",
@@ -24,6 +25,7 @@ const localConfig: PlaywrightTestConfig = {
2425
name: "letterQueue-tests",
2526
testDir: path.resolve(__dirname, "../component-tests/letterQueue-tests"),
2627
testMatch: "**/*.spec.ts",
28+
dependencies: ["apiGateway-tests"],
2729
},
2830
{
2931
name: "integration-tests",

0 commit comments

Comments
 (0)