Skip to content

Commit f7b6afa

Browse files
tests - manual fixes
1 parent 836a26c commit f7b6afa

23 files changed

Lines changed: 81 additions & 128 deletions

tests/component-tests/apiGateway-tests/createMi.spec.ts renamed to tests/component-tests/apiGateway-tests/create-mi.spec.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
11
import { expect, test } from "@playwright/test";
2-
import { time } from "node:console";
3-
import { getRestApiGatewayBaseUrl } from "../../helpers/awsGatewayHelper";
4-
import { MI_ENDPOINT } from "../../constants/api_constants";
2+
import { getRestApiGatewayBaseUrl } from "../../helpers/aws-gateway-helper";
3+
import { MI_ENDPOINT } from "../../constants/api-constants";
54
import {
65
createHeaderWithNoCorrelationId,
76
createHeaderWithNoRequestId,
87
createInvalidRequestHeaders,
98
createValidRequestHeaders,
10-
} from "../../constants/request_headers";
9+
} from "../../constants/request-headers";
1110
import {
1211
miInvalidDateRequest,
1312
miInvalidRequest,
1413
miValidRequest,
15-
} from "./testCases/createMi";
14+
} from "./testCases/create-mi";
1615
import {
1716
error400InvalidDate,
1817
error400ResponseBody,
1918
error403ResponseBody,
20-
error404ResponseBody,
2119
requestId500Error,
22-
} from "../../helpers/commonTypes";
20+
} from "../../helpers/common-types";
2321

2422
let baseUrl: string;
2523

tests/component-tests/apiGateway-tests/getLetterStatus.spec.ts renamed to tests/component-tests/apiGateway-tests/get-letter-status.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { expect, test } from "@playwright/test";
2-
import { getRestApiGatewayBaseUrl } from "../../helpers/awsGatewayHelper";
3-
import { getLettersBySupplier } from "../../helpers/generate_fetch_testData";
4-
import { SUPPLIERID, SUPPLIER_LETTERS } from "../../constants/api_constants";
5-
import { createValidRequestHeaders } from "../../constants/request_headers";
2+
import { getRestApiGatewayBaseUrl } from "../../helpers/aws-gateway-helper";
3+
import { getLettersBySupplier } from "../../helpers/generate-fetch-test-data";
4+
import { SUPPLIERID, SUPPLIER_LETTERS } from "../../constants/api-constants";
5+
import { createValidRequestHeaders } from "../../constants/request-headers";
66
import {
77
error404ResponseBody,
88
error500ResponseBody,
9-
} from "../../helpers/commonTypes";
9+
} from "../../helpers/common-types";
1010

1111
let baseUrl: string;
1212

tests/component-tests/apiGateway-tests/getLetters.spec.ts renamed to tests/component-tests/apiGateway-tests/get-letters.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { expect, test } from "@playwright/test";
2-
import { SUPPLIER_LETTERS } from "../../constants/api_constants";
2+
import { SUPPLIER_LETTERS } from "../../constants/api-constants";
33
import {
44
createHeaderWithNoCorrelationId,
55
createInvalidRequestHeaders,
66
createValidRequestHeaders,
7-
} from "../../constants/request_headers";
8-
import { getRestApiGatewayBaseUrl } from "../../helpers/awsGatewayHelper";
9-
import { validateApiResponse } from "../../helpers/validateJsonSchema";
7+
} from "../../constants/request-headers";
8+
import { getRestApiGatewayBaseUrl } from "../../helpers/aws-gateway-helper";
9+
import { validateApiResponse } from "../../helpers/validate-json-schema";
1010

1111
let baseUrl: string;
1212

tests/component-tests/apiGateway-tests/testCases/createMi.ts renamed to tests/component-tests/apiGateway-tests/testCases/create-mi.ts

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ export type MiRequestBody = {
1313
};
1414

1515
export function miValidRequest(): MiRequestBody {
16-
let requestBody: MiRequestBody;
17-
18-
requestBody = {
16+
return {
1917
data: {
2018
attributes: {
2119
groupId: "group123",
@@ -28,13 +26,10 @@ export function miValidRequest(): MiRequestBody {
2826
type: "ManagementInformation",
2927
},
3028
};
31-
return requestBody;
3229
}
3330

3431
export function miInvalidRequest(): MiRequestBody {
35-
let requestBody: MiRequestBody;
36-
37-
requestBody = {
32+
return {
3833
data: {
3934
attributes: {
4035
groupId: "group123",
@@ -47,13 +42,10 @@ export function miInvalidRequest(): MiRequestBody {
4742
type: "?",
4843
},
4944
};
50-
return requestBody;
5145
}
5246

5347
export function miInvalidDateRequest(): MiRequestBody {
54-
let requestBody: MiRequestBody;
55-
56-
requestBody = {
48+
return {
5749
data: {
5850
attributes: {
5951
groupId: "group123",
@@ -66,5 +58,4 @@ export function miInvalidDateRequest(): MiRequestBody {
6658
type: "ManagementInformation",
6759
},
6860
};
69-
return requestBody;
7061
}

tests/component-tests/apiGateway-tests/testCases/updateLetterStatus.ts renamed to tests/component-tests/apiGateway-tests/testCases/update-letter-status.ts

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { RequestHeaders } from "../../../constants/request_headers";
2-
import { SUPPLIERID } from "../../../constants/api_constants";
3-
import { ErrorMessageBody } from "../../../helpers/commonTypes";
1+
import { RequestHeaders } from "../../../constants/request-headers";
2+
import { SUPPLIERID } from "../../../constants/api-constants";
3+
import { ErrorMessageBody } from "../../../helpers/common-types";
44

55
export type PatchMessageRequestBody = {
66
data: {
@@ -29,23 +29,19 @@ export type PatchMessageResponseBody = {
2929
};
3030

3131
export function patchRequestHeaders(): RequestHeaders {
32-
let requestHeaders: RequestHeaders;
33-
requestHeaders = {
32+
return {
3433
headerauth1: process.env.HEADERAUTH || "",
3534
"NHSD-Supplier-ID": SUPPLIERID,
3635
"NHSD-Correlation-ID": "12344",
3736
"X-Request-ID": "requestId1",
3837
};
39-
return requestHeaders;
4038
}
4139

4240
export function patchValidRequestBody(
4341
id: string,
4442
status: string,
4543
): PatchMessageRequestBody {
46-
let requestBody: PatchMessageRequestBody;
47-
48-
requestBody = {
44+
return {
4945
data: {
5046
attributes: {
5147
status,
@@ -54,16 +50,13 @@ export function patchValidRequestBody(
5450
id,
5551
},
5652
};
57-
return requestBody;
5853
}
5954

6055
export function patchFailureRequestBody(
6156
id: string,
6257
status: string,
6358
): PatchMessageRequestBody {
64-
let requestBody: PatchMessageRequestBody;
65-
66-
requestBody = {
59+
return {
6760
data: {
6861
attributes: {
6962
status,
@@ -74,12 +67,10 @@ export function patchFailureRequestBody(
7467
id,
7568
},
7669
};
77-
return requestBody;
7870
}
7971

8072
export function patch400ErrorResponseBody(): ErrorMessageBody {
81-
let responseBody: ErrorMessageBody;
82-
responseBody = {
73+
return {
8374
errors: [
8475
{
8576
id: "12344",
@@ -94,12 +85,10 @@ export function patch400ErrorResponseBody(): ErrorMessageBody {
9485
},
9586
],
9687
};
97-
return responseBody;
9888
}
9989

10090
export function patch500ErrorResponseBody(id: string): ErrorMessageBody {
101-
let responseBody: ErrorMessageBody;
102-
responseBody = {
91+
return {
10392
errors: [
10493
{
10594
id: "12344",
@@ -114,5 +103,4 @@ export function patch500ErrorResponseBody(id: string): ErrorMessageBody {
114103
},
115104
],
116105
};
117-
return responseBody;
118106
}

tests/component-tests/apiGateway-tests/updateLetterStatus.spec.ts renamed to tests/component-tests/apiGateway-tests/update-letter-status.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
import { expect, test } from "@playwright/test";
22
import { randomUUID } from "node:crypto";
3-
import { SUPPLIERID, SUPPLIER_LETTERS } from "../../constants/api_constants";
4-
import { getRestApiGatewayBaseUrl } from "../../helpers/awsGatewayHelper";
3+
import { SUPPLIERID, SUPPLIER_LETTERS } from "../../constants/api-constants";
4+
import { getRestApiGatewayBaseUrl } from "../../helpers/aws-gateway-helper";
55
import {
66
patch400ErrorResponseBody,
77
patch500ErrorResponseBody,
88
patchFailureRequestBody,
99
patchRequestHeaders,
1010
patchValidRequestBody,
11-
} from "./testCases/updateLetterStatus";
11+
} from "./testCases/update-letter-status";
1212
import {
1313
createTestData,
1414
deleteLettersBySupplier,
1515
getLettersBySupplier,
16-
} from "../../helpers/generate_fetch_testData";
17-
import { createInvalidRequestHeaders } from "../../constants/request_headers";
18-
import { error403ResponseBody } from "../../helpers/commonTypes";
16+
} from "../../helpers/generate-fetch-test-data";
17+
import { createInvalidRequestHeaders } from "../../constants/request-headers";
18+
import { error403ResponseBody } from "../../helpers/common-types";
1919

2020
let baseUrl: string;
2121

tests/config/playwright.base.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { PlaywrightTestConfig, defineConfig } from "@playwright/test";
22
import "dotenv/config";
33

4-
const baseUrl = process.env.NHSD_APIM_PROXY_URL || "http://localhost:3000/";
5-
const envMaxInstances = Number.parseInt(process.env.WORKERS_MAX_INST!) || 10;
4+
const envMaxInstances =
5+
Number.parseInt(process.env.WORKERS_MAX_INST!, 10) || 10;
66
/**
77
* See https://playwright.dev/docs/test-configuration.
88
*/
Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { randomUUID } from "node:crypto";
2-
import { SUPPLIERID } from "./api_constants";
2+
import { SUPPLIERID } from "./api-constants";
33

44
export const sandBoxHeader: RequestSandBoxHeaders = {
55
"X-Request-ID": randomUUID(),
@@ -22,45 +22,37 @@ export interface RequestSandBoxHeaders {
2222
}
2323

2424
export function createInvalidRequestHeaders(): RequestHeaders {
25-
let requestHeaders: RequestHeaders;
26-
requestHeaders = {
25+
return {
2726
headerauth1: "",
2827
"NHSD-Supplier-ID": SUPPLIERID,
2928
"NHSD-Correlation-ID": "1234",
3029
"X-Request-ID": "requestId1",
3130
};
32-
return requestHeaders;
3331
}
3432

3533
export function createHeaderWithNoCorrelationId(): RequestHeaders {
36-
let requestHeaders: RequestHeaders;
37-
requestHeaders = {
34+
return {
3835
headerauth1: process.env.HEADERAUTH || "",
3936
"NHSD-Supplier-ID": SUPPLIERID,
4037
"NHSD-Correlation-ID": "",
4138
"X-Request-ID": "requestId1",
4239
};
43-
return requestHeaders;
4440
}
4541

4642
export function createValidRequestHeaders(): RequestHeaders {
47-
let requestHeaders: RequestHeaders;
48-
requestHeaders = {
43+
return {
4944
headerauth1: process.env.HEADERAUTH || "",
5045
"NHSD-Supplier-ID": SUPPLIERID,
5146
"NHSD-Correlation-ID": "12345",
5247
"X-Request-ID": "requestId1",
5348
};
54-
return requestHeaders;
5549
}
5650

5751
export function createHeaderWithNoRequestId(): RequestHeaders {
58-
let requestHeaders: RequestHeaders;
59-
requestHeaders = {
52+
return {
6053
headerauth1: process.env.HEADERAUTH || "",
6154
"NHSD-Supplier-ID": SUPPLIERID,
6255
"NHSD-Correlation-ID": "1234",
6356
"X-Request-ID": "",
6457
};
65-
return requestHeaders;
6658
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {
22
APIGatewayClient,
33
GetRestApisCommand,
44
} from "@aws-sdk/client-api-gateway";
5-
import { API_NAME, AWS_REGION } from "../constants/api_constants";
5+
import { API_NAME, AWS_REGION } from "../constants/api-constants";
66

77
export async function getRestApiGatewayBaseUrl(): Promise<string> {
88
const region = AWS_REGION;

0 commit comments

Comments
 (0)