Skip to content

Commit d18d495

Browse files
tests
1 parent 223d427 commit d18d495

File tree

2 files changed

+12
-56
lines changed

2 files changed

+12
-56
lines changed

tests/component-tests/apiGateway-tests/updateLetterStatus.spec.ts

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ test.beforeAll(async () => {
1414
});
1515

1616
test.describe('API Gateway Tests to Verify Patch Status Endpoint', () => {
17-
test(`Patch /letters returns 200 and status is updated to ACCEPTED`, async ({ request }) => {
17+
test(`Patch /letters returns 202 and status is updated to ACCEPTED`, async ({ request }) => {
1818

1919
await createTestData(SUPPLIERID);
2020
const letters = await getLettersBySupplier(SUPPLIERID, 'PENDING', 1);
@@ -33,23 +33,12 @@ test.describe('API Gateway Tests to Verify Patch Status Endpoint', () => {
3333
});
3434

3535
const responseBody = await response.json();
36-
expect(response.status()).toBe(200);
37-
expect(responseBody).toMatchObject({
38-
data:{
39-
attributes: {
40-
status: 'ACCEPTED',
41-
specificationId: letter.specificationId,
42-
groupId: letter.groupId,
43-
},
44-
id: letter.id,
45-
type: 'Letter'
46-
}
47-
});
36+
expect(response.status()).toBe(202);
4837

4938
await deleteLettersBySupplier(letter.id);
5039
});
5140

52-
test(`Patch /letters returns 200 and status is updated to REJECTED`, async ({ request }) => {
41+
test(`Patch /letters returns 202 and status is updated to REJECTED`, async ({ request }) => {
5342

5443
await createTestData(SUPPLIERID);
5544
const letters = await getLettersBySupplier(SUPPLIERID, 'PENDING', 1);
@@ -68,18 +57,7 @@ test.describe('API Gateway Tests to Verify Patch Status Endpoint', () => {
6857
});
6958

7059
const responseBody = await response.json();
71-
expect(response.status()).toBe(200);
72-
expect(responseBody).toMatchObject({
73-
data:{
74-
attributes: {
75-
status: 'REJECTED',
76-
specificationId: letter.specificationId,
77-
groupId: letter.groupId,
78-
},
79-
id: letter.id,
80-
type: 'Letter'
81-
}
82-
});
60+
expect(response.status()).toBe(202);
8361

8462
await deleteLettersBySupplier(letter.id);
8563
});

tests/sandbox/testCases/updateLetterStatus_testCases.ts

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ export type ApiSandboxUpdateLetterStatusTestData = {
1616

1717
export const apiSandboxUpdateLetterStatusTestData: ApiSandboxUpdateLetterStatusTestData[] = [
1818
{
19-
testCase: '200 response if record is updated with status PENDING',
20-
id: '2WL5eYSWGzCHlGmzNxuqVusPxDg',
19+
testCase: '202 response if record is updated with status PENDING',
20+
id: '24L5eYSWGzCHlGmzNxuqVusPxDg',
2121
header: sandBoxHeader,
2222
body: {
2323
data: {
@@ -28,47 +28,25 @@ export const apiSandboxUpdateLetterStatusTestData: ApiSandboxUpdateLetterStatusT
2828
},
2929
}
3030
},
31-
expectedStatus: 200,
32-
expectedResponse: {
33-
data: {
34-
type: 'Letter',
35-
id: '2WL5eYSWGzCHlGmzNxuqVusPxDg',
36-
attributes: {
37-
status: 'PENDING',
38-
specificationId:'2WL5eYSWGzCHlGmzNxuqVusPxDg',
39-
},
40-
}
41-
},
31+
expectedStatus: 202,
4232
},
4333

4434
{
45-
testCase: '200 response if record is updated with status REJECTED',
46-
id: '2WL5eYSWGzCHlGmzNxuqVusPxDg',
35+
testCase: '202 response if record is updated with status REJECTED',
36+
id: '24L5eYSWGzCHlGmzNxuqVusPxDg',
4737
header: sandBoxHeader,
4838
body: {
4939
data: {
5040
type: 'Letter',
5141
id: '2WL5eYSWGzCHlGmzNxuqVusPxDg',
5242
attributes: {
5343
status: 'REJECTED',
54-
reasonCode: 100,
55-
reasonText: 'failed validation',
56-
},
57-
}
58-
},
59-
expectedStatus: 200,
60-
expectedResponse: {
61-
data: {
62-
type: 'Letter',
63-
id: '2WL5eYSWGzCHlGmzNxuqVusPxDg',
64-
attributes: {
65-
reasonCode: 100,
66-
reasonText: 'failed validation',
67-
status: 'REJECTED',
68-
specificationId:'2WL5eYSWGzCHlGmzNxuqVusPxDg',
44+
reasonCode: 'R07',
45+
reasonText: 'No such address',
6946
},
7047
}
7148
},
49+
expectedStatus: 202,
7250
},
7351
{
7452
testCase: '404 response if no resource is found for the given id',

0 commit comments

Comments
 (0)