Skip to content

Commit 8f26fe3

Browse files
test auto fixes
1 parent 43f9ec0 commit 8f26fe3

15 files changed

Lines changed: 111 additions & 101 deletions

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 = {
Lines changed: 50 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,63 @@
1-
import { envName, LETTERSTABLENAME, SUPPLIERID } from "../constants/api_constants";
1+
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
2+
import {
3+
DeleteCommand,
4+
DynamoDBDocumentClient,
5+
QueryCommand,
6+
} from "@aws-sdk/lib-dynamodb";
7+
import {
8+
LETTERSTABLENAME,
9+
SUPPLIERID,
10+
envName,
11+
} from "../constants/api_constants";
212
import { runCreateLetter } from "./pnpmHelpers";
3-
import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
4-
import { DeleteCommand, DynamoDBDocumentClient, QueryCommand } from '@aws-sdk/lib-dynamodb';
513

614
const ddb = new DynamoDBClient({});
715
const docClient = DynamoDBDocumentClient.from(ddb);
816

917
export interface SupplierApiLetters {
10-
supplierId: string,
11-
specificationId: string,
12-
supplierStatus: string,
13-
createdAt: string,
14-
supplierStatusSk: string,
15-
updatedAt: string,
16-
groupId: string,
17-
reasonCode: string,
18-
id: string,
19-
url: string,
20-
ttl: string,
21-
reasonText: string,
22-
status: string,
23-
source: string
24-
};
18+
supplierId: string;
19+
specificationId: string;
20+
supplierStatus: string;
21+
createdAt: string;
22+
supplierStatusSk: string;
23+
updatedAt: string;
24+
groupId: string;
25+
reasonCode: string;
26+
id: string;
27+
url: string;
28+
ttl: string;
29+
reasonText: string;
30+
status: string;
31+
source: string;
32+
}
2533

2634
export async function createTestData(supplierId: string): Promise<void> {
27-
28-
await runCreateLetter({
29-
filter: 'nhs-notify-supplier-api-data-generator',
30-
supplierId: supplierId,
35+
await runCreateLetter({
36+
filter: "nhs-notify-supplier-api-data-generator",
37+
supplierId,
3138
environment: envName,
32-
awsAccountId: '820178564574',
33-
groupId: 'TestGroupID',
34-
specificationId: 'TestSpecificationID',
35-
status: 'PENDING',
39+
awsAccountId: "820178564574",
40+
groupId: "TestGroupID",
41+
specificationId: "TestSpecificationID",
42+
status: "PENDING",
3643
count: 1,
3744
});
38-
};
39-
40-
export const getLettersBySupplier = async(supplierId: string, status: string, limit: number) => {
45+
}
4146

42-
const supplierStatus = `${supplierId}#${status}`;
43-
const params = {
47+
export const getLettersBySupplier = async (
48+
supplierId: string,
49+
status: string,
50+
limit: number,
51+
) => {
52+
const supplierStatus = `${supplierId}#${status}`;
53+
const params = {
4454
TableName: LETTERSTABLENAME,
45-
IndexName: 'supplierStatus-index',
46-
KeyConditionExpression: 'supplierStatus = :supplierStatus',
55+
IndexName: "supplierStatus-index",
56+
KeyConditionExpression: "supplierStatus = :supplierStatus",
4757
ProjectionExpression:
48-
'id, specificationId, groupId, reasonCode, reasonText',
58+
"id, specificationId, groupId, reasonCode, reasonText",
4959
ExpressionAttributeValues: {
50-
':supplierStatus': supplierStatus,
60+
":supplierStatus": supplierStatus,
5161
},
5262
Limit: limit,
5363
};
@@ -59,13 +69,13 @@ export const getLettersBySupplier = async(supplierId: string, status: string, li
5969
return Items as SupplierApiLetters[];
6070
};
6171

62-
export const deleteLettersBySupplier = async(id: string) => {
72+
export const deleteLettersBySupplier = async (id: string) => {
6373
const resp = await docClient.send(
6474
new DeleteCommand({
6575
TableName: LETTERSTABLENAME,
6676
Key: { supplierId: SUPPLIERID, id },
67-
ReturnValues: 'ALL_OLD',
68-
})
69-
)
77+
ReturnValues: "ALL_OLD",
78+
}),
79+
);
7080
return resp.Attributes;
71-
}
81+
};

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
});

0 commit comments

Comments
 (0)