Skip to content

Commit 3ec412e

Browse files
test auto fixes
1 parent 4e9a29c commit 3ec412e

14 files changed

+61
-61
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ test.describe("API Gateway Tests to Verify Get Letter Status Endpoint", () => {
3030
`${baseUrl}/${SUPPLIER_LETTERS}/${letter.id}`,
3131
{
3232
headers,
33-
}
33+
},
3434
);
3535

3636
const responseBody = await response.json();
Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,70 @@
1-
2-
3-
41
export type MiRequestBody = {
52
data: {
63
type: string;
74
attributes: {
8-
groupId: string;
9-
lineItem: string;
10-
quantity: number;
11-
specificationId: string;
12-
stockRemaining: number;
13-
timestamp: string;
5+
groupId: string;
6+
lineItem: string;
7+
quantity: number;
8+
specificationId: string;
9+
stockRemaining: number;
10+
timestamp: string;
1411
};
1512
};
1613
};
1714

18-
export function miValidRequest() : MiRequestBody{
15+
export function miValidRequest(): MiRequestBody {
1916
let requestBody: MiRequestBody;
2017

2118
requestBody = {
2219
data: {
23-
 attributes: {
24-
groupId: 'group123',
25-
lineItem: 'envelope-business-standard',
20+
attributes: {
21+
groupId: "group123",
22+
lineItem: "envelope-business-standard",
2623
quantity: 10,
27-
specificationId: 'Test-Spec-Id',
24+
specificationId: "Test-Spec-Id",
2825
stockRemaining: 100,
2926
timestamp: new Date().toISOString(),
3027
},
31-
type: 'ManagementInformation',
32-
}};
28+
type: "ManagementInformation",
29+
},
30+
};
3331
return requestBody;
3432
}
3533

36-
export function miInvalidRequest() : MiRequestBody{
34+
export function miInvalidRequest(): MiRequestBody {
3735
let requestBody: MiRequestBody;
3836

3937
requestBody = {
4038
data: {
41-
 attributes: {
42-
groupId: 'group123',
43-
lineItem: 'envelope-business-standard',
39+
attributes: {
40+
groupId: "group123",
41+
lineItem: "envelope-business-standard",
4442
quantity: 10,
45-
specificationId: 'Test-Spec-Id',
43+
specificationId: "Test-Spec-Id",
4644
stockRemaining: 100,
4745
timestamp: new Date().toISOString(),
4846
},
49-
type: '?',
50-
}};
47+
type: "?",
48+
},
49+
};
5150
return requestBody;
5251
}
5352

54-
export function miInvalidDateRequest() : MiRequestBody{
53+
export function miInvalidDateRequest(): MiRequestBody {
5554
let requestBody: MiRequestBody;
5655

5756
requestBody = {
5857
data: {
59-
 attributes: {
60-
groupId: 'group123',
61-
lineItem: 'envelope-business-standard',
58+
attributes: {
59+
groupId: "group123",
60+
lineItem: "envelope-business-standard",
6261
quantity: 10,
63-
specificationId: 'Test-Spec-Id',
62+
specificationId: "Test-Spec-Id",
6463
stockRemaining: 100,
65-
timestamp: '2021-10-28T',
64+
timestamp: "2021-10-28T",
6665
},
67-
type: 'ManagementInformation',
68-
}};
66+
type: "ManagementInformation",
67+
},
68+
};
6969
return requestBody;
7070
}

tests/component-tests/apiGateway-tests/testCases/update-letter-status.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export function patchRequestHeaders(): RequestHeaders {
4141

4242
export function patchValidRequestBody(
4343
id: string,
44-
status: string
44+
status: string,
4545
): PatchMessageRequestBody {
4646
let requestBody: PatchMessageRequestBody;
4747

@@ -59,7 +59,7 @@ export function patchValidRequestBody(
5959

6060
export function patchFailureRequestBody(
6161
id: string,
62-
status: string
62+
status: string,
6363
): PatchMessageRequestBody {
6464
let requestBody: PatchMessageRequestBody;
6565

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ test.describe("API Gateway Tests to Verify Patch Status Endpoint", () => {
4545
{
4646
headers,
4747
data: body,
48-
}
48+
},
4949
);
5050

5151
expect(response.status()).toBe(202);
@@ -72,7 +72,7 @@ test.describe("API Gateway Tests to Verify Patch Status Endpoint", () => {
7272
{
7373
headers,
7474
data: body,
75-
}
75+
},
7676
);
7777

7878
expect(response.status()).toBe(202);
@@ -92,7 +92,7 @@ test.describe("API Gateway Tests to Verify Patch Status Endpoint", () => {
9292
{
9393
headers,
9494
data: body,
95-
}
95+
},
9696
);
9797

9898
const responseBody = await response.json();
@@ -113,7 +113,7 @@ test.describe("API Gateway Tests to Verify Patch Status Endpoint", () => {
113113
{
114114
headers,
115115
data: body,
116-
}
116+
},
117117
);
118118

119119
const responseBody = await response.json();
@@ -133,7 +133,7 @@ test.describe("API Gateway Tests to Verify Patch Status Endpoint", () => {
133133
{
134134
headers,
135135
data: body,
136-
}
136+
},
137137
);
138138

139139
const responseBody = await response.json();

tests/config/reporters.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { ReporterDescription } from "@playwright/test";
2-
import path from "path";
2+
import path from "node:path";
33

44
const resultsDir = process.env.RESULTS_DIR || "results";
55
const reportsDir = process.env.REPORTS_DIR || "reports";

tests/config/sandbox.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { PlaywrightTestConfig } from "@playwright/test";
2+
import path from "node:path";
23
import { config as baseConfig } from "./playwright.base.config";
34
import { getReporters } from "./reporters";
4-
import path from "path";
55

66
const localConfig: PlaywrightTestConfig = {
77
/* Reporter to use. See https://playwright.dev/docs/test-reporters */

tests/helpers/generate-fetch-test-data.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export interface SupplierApiLetters {
3333

3434
export async function createTestData(
3535
supplierId: string,
36-
count?: number
36+
count?: number,
3737
): Promise<void> {
3838
await runCreateLetter({
3939
filter: "nhs-notify-supplier-api-letter-test-data-utility",
@@ -50,7 +50,7 @@ export async function createTestData(
5050
export const getLettersBySupplier = async (
5151
supplierId: string,
5252
status: string,
53-
limit: number
53+
limit: number,
5454
) => {
5555
const supplierStatus = `${supplierId}#${status}`;
5656
const params = {
@@ -78,13 +78,13 @@ export const deleteLettersBySupplier = async (id: string) => {
7878
TableName: LETTERSTABLENAME,
7979
Key: { supplierId: SUPPLIERID, id },
8080
ReturnValues: "ALL_OLD",
81-
})
81+
}),
8282
);
8383
return resp.Attributes;
8484
};
8585

8686
export async function checkSupplierExists(
87-
supplierId: string
87+
supplierId: string,
8888
): Promise<boolean> {
8989
try {
9090
const params = {

tests/helpers/pnpm-helpers.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export async function runCreateLetter(options: {
2929

3030
const workspaceRoot = path.resolve(
3131
__dirname,
32-
"../../scripts/utilities/letter-test-data"
32+
"../../scripts/utilities/letter-test-data",
3333
);
3434
const cmd = process.platform === "win32" ? "npm.cmd" : "npm";
3535
const root = path.resolve(workspaceRoot);
@@ -73,7 +73,7 @@ export async function runCreateLetter(options: {
7373
});
7474

7575
child.on("close", (code) =>
76-
code === 0 ? resolve() : reject(new Error(`pnpm exited with ${code}`))
76+
code === 0 ? resolve() : reject(new Error(`pnpm exited with ${code}`)),
7777
);
7878
child.on("error", reject);
7979
});
@@ -87,11 +87,11 @@ export async function createSupplierData(options: {
8787
environment: string;
8888
status: string;
8989
}) {
90-
const { apimId, environment, name, status, supplierId, filter } = options;
90+
const { apimId, environment, filter, name, status, supplierId } = options;
9191

9292
const workspaceRoot = path.resolve(
9393
__dirname,
94-
"../../scripts/utilities/supplier-data"
94+
"../../scripts/utilities/supplier-data",
9595
);
9696
const cmd = process.platform === "win32" ? "npm.cmd" : "npm";
9797
const root = path.resolve(workspaceRoot);
@@ -131,7 +131,7 @@ export async function createSupplierData(options: {
131131
});
132132

133133
child.on("close", (code) =>
134-
code === 0 ? resolve() : reject(new Error(`pnpm exited with ${code}`))
134+
code === 0 ? resolve() : reject(new Error(`pnpm exited with ${code}`)),
135135
);
136136
child.on("error", reject);
137137
});

tests/helpers/validate-json-schema.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default async function validateApiResponse(
1919
method: string,
2020
pathVar: string,
2121
status: number,
22-
body: any
22+
body: any,
2323
): Promise<ValidationResult> {
2424
const openapiDoc = await import(paths);
2525

@@ -36,7 +36,7 @@ export default async function validateApiResponse(
3636
operation.responses[status] || operation.responses.default;
3737
if (!responseSchema) {
3838
throw new Error(
39-
`No schema defined for status ${status} at ${method.toUpperCase()} ${pathVar}`
39+
`No schema defined for status ${status} at ${method.toUpperCase()} ${pathVar}`,
4040
);
4141
}
4242

tests/mtls/mtls-test.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { test, expect, request, APIRequestContext } from "@playwright/test";
1+
import { APIRequestContext, expect, request, test } from "@playwright/test";
22

33
// Assume you have your constants in a config file
4-
const PROXY_URL = process.env.PROXY_URL;
4+
const { PROXY_URL } = process.env;
55

66
test("should fail when connecting without client certificate", async () => {
77
let apiContext: APIRequestContext | null = null;
@@ -15,15 +15,15 @@ test("should fail when connecting without client certificate", async () => {
1515
// Check if request succeeded or failed
1616
if (response.ok()) {
1717
throw new Error(
18-
`Expected connection failure, but got success with status ${response.status()}`
18+
`Expected connection failure, but got success with status ${response.status()}`,
1919
);
2020
}
2121
// Assert on the actual error code returned by the gateway
2222
// For mTLS, often 401, 403, or 502 depending on infra config
2323
expect(response.ok()).toBeFalsy();
24-
} catch (err: any) {
24+
} catch (error: any) {
2525
// If the request truly fails at the TLS layer, Playwright will throw instead
26-
expect(err.message).toMatch(/SSL|certificate|ECONNRESET|socket/i);
26+
expect(error.message).toMatch(/SSL|certificate|ECONNRESET|socket/i);
2727
} finally {
2828
if (apiContext) {
2929
await apiContext.dispose();

0 commit comments

Comments
 (0)