Skip to content

Commit 0e58193

Browse files
authored
test(snapshot-testing): error response snapshots (#7836)
1 parent e692718 commit 0e58193

File tree

681 files changed

+55666
-2804
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

681 files changed

+55666
-2804
lines changed

clients/client-acm-pca/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"@smithy/util-middleware": "^4.2.11",
5858
"@smithy/util-retry": "^4.2.11",
5959
"@smithy/util-utf8": "^4.2.2",
60-
"@smithy/util-waiter": "^4.2.11",
60+
"@smithy/util-waiter": "^4.2.12",
6161
"tslib": "^2.6.2"
6262
},
6363
"devDependencies": {

clients/client-acm/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"@smithy/util-middleware": "^4.2.11",
6060
"@smithy/util-retry": "^4.2.11",
6161
"@smithy/util-utf8": "^4.2.2",
62-
"@smithy/util-waiter": "^4.2.11",
62+
"@smithy/util-waiter": "^4.2.12",
6363
"tslib": "^2.6.2"
6464
},
6565
"devDependencies": {

clients/client-amp/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"@smithy/util-middleware": "^4.2.11",
5858
"@smithy/util-retry": "^4.2.11",
5959
"@smithy/util-utf8": "^4.2.2",
60-
"@smithy/util-waiter": "^4.2.11",
60+
"@smithy/util-waiter": "^4.2.12",
6161
"tslib": "^2.6.2"
6262
},
6363
"devDependencies": {

clients/client-appconfig/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"@smithy/util-retry": "^4.2.11",
5959
"@smithy/util-stream": "^4.5.17",
6060
"@smithy/util-utf8": "^4.2.2",
61-
"@smithy/util-waiter": "^4.2.11",
61+
"@smithy/util-waiter": "^4.2.12",
6262
"tslib": "^2.6.2"
6363
},
6464
"devDependencies": {

clients/client-appconfigdata/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"tslib": "^2.6.2"
6666
},
6767
"devDependencies": {
68-
"@smithy/snapshot-testing": "^1.0.10",
68+
"@smithy/snapshot-testing": "^2.0.0",
6969
"@tsconfig/node20": "20.1.8",
7070
"@types/node": "^20.14.8",
7171
"concurrently": "7.0.0",

clients/client-appconfigdata/test/snapshots.integ.spec.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@ import { describe, expect, test as it, vi } from "vitest";
55

66
import {
77
AppConfigDataClient,
8+
BadRequestException$,
89
GetLatestConfiguration$,
910
GetLatestConfigurationCommand,
11+
InternalServerException$,
12+
ResourceNotFoundException$,
1013
StartConfigurationSession$,
1114
StartConfigurationSessionCommand,
15+
ThrottlingException$,
1216
} from "../src";
1317

1418
vi.setSystemTime(new Date(946702799999));
@@ -28,13 +32,16 @@ describe("AppConfigDataClient" + ` (${mode})`, () => {
2832
expect(actual).toEqual(expected);
2933
return Promise.resolve();
3034
},
31-
schemas:
32-
new Map<any, any>([
33-
[GetLatestConfiguration$, GetLatestConfigurationCommand],
34-
[StartConfigurationSession$, StartConfigurationSessionCommand],
35-
]),
36-
35+
schemas: new Map<any, any>([
36+
[GetLatestConfiguration$, GetLatestConfigurationCommand],
37+
[StartConfigurationSession$, StartConfigurationSessionCommand],
38+
]),
39+
errors: [
40+
BadRequestException$,
41+
InternalServerException$,
42+
ResourceNotFoundException$,
43+
ThrottlingException$,
44+
],
3745
});
38-
3946
runner.run();
4047
}, 30_000);
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
======================== minimal response ========================
2+
[status] 400
3+
4+
content-type: application/json
5+
6+
[Uint8Array (json)]
7+
{
8+
"XAmznErrorType": "com.amazonaws.appconfigdata#BadRequestException"
9+
}
10+
11+
12+
--- [error name & message] ---
13+
Unknown: UnknownError
14+
15+
--- [error object] ---
16+
{
17+
$fault: "client",
18+
$retryable: (undefined),
19+
$metadata: {
20+
httpStatusCode: (number) 400,
21+
requestId: (undefined),
22+
extendedRequestId: (undefined),
23+
cfId: (undefined),
24+
attempts: (number) 1,
25+
totalRetryDelay: (number) 0
26+
},
27+
name: "Unknown",
28+
XAmznErrorType: "com.amazonaws.appconfigdata#BadRequestException",
29+
message: "UnknownError"
30+
}
31+
32+
======================== w/ optional fields ========================
33+
[status] 400
34+
35+
content-type: application/json
36+
37+
[Uint8Array (json)]
38+
{
39+
"XAmznErrorType": "com.amazonaws.appconfigdata#BadRequestException",
40+
"Message": "__Message__",
41+
"Reason": "__Reason__",
42+
"Details": {
43+
"InvalidParameters": {
44+
"key1": {
45+
"Problem": "__Problem__"
46+
},
47+
"key2": {
48+
"Problem": "__Problem__"
49+
}
50+
}
51+
}
52+
}
53+
54+
55+
--- [error name & message] ---
56+
Unknown: __Message__
57+
58+
--- [error object] ---
59+
{
60+
$fault: "client",
61+
$retryable: (undefined),
62+
$metadata: {
63+
httpStatusCode: (number) 400,
64+
requestId: (undefined),
65+
extendedRequestId: (undefined),
66+
cfId: (undefined),
67+
attempts: (number) 1,
68+
totalRetryDelay: (number) 0
69+
},
70+
name: "Unknown",
71+
XAmznErrorType: "com.amazonaws.appconfigdata#BadRequestException",
72+
Reason: "__Reason__",
73+
Details: {
74+
InvalidParameters: {
75+
key1: {
76+
Problem: "__Problem__"
77+
},
78+
key2: {
79+
Problem: "__Problem__"
80+
}
81+
}
82+
},
83+
message: "__Message__"
84+
}
85+
86+
======================== frontend error ========================
87+
[status] 500
88+
89+
content-type: text/html
90+
91+
[Uint8Array (text)]
92+
An unmodeled error occurred in a front end layer.
93+
94+
95+
--- [error name & message] ---
96+
SyntaxError: Unexpected token 'A', "An unmodel"... is not valid JSON
97+
Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.
98+
99+
--- [error object] ---
100+
{
101+
$metadata: {
102+
httpStatusCode: (number) 500,
103+
requestId: (undefined),
104+
extendedRequestId: (undefined),
105+
cfId: (undefined),
106+
attempts: (number) 1,
107+
totalRetryDelay: (number) 0
108+
}
109+
}
110+
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
======================== minimal response ========================
2+
[status] 500
3+
4+
content-type: application/json
5+
6+
[Uint8Array (json)]
7+
{
8+
"XAmznErrorType": "com.amazonaws.appconfigdata#InternalServerException"
9+
}
10+
11+
12+
--- [error name & message] ---
13+
Unknown: UnknownError
14+
15+
--- [error object] ---
16+
{
17+
$fault: "server",
18+
$retryable: (undefined),
19+
$metadata: {
20+
httpStatusCode: (number) 500,
21+
requestId: (undefined),
22+
extendedRequestId: (undefined),
23+
cfId: (undefined),
24+
attempts: (number) 1,
25+
totalRetryDelay: (number) 0
26+
},
27+
name: "Unknown",
28+
XAmznErrorType: "com.amazonaws.appconfigdata#InternalServerException",
29+
message: "UnknownError"
30+
}
31+
32+
======================== w/ optional fields ========================
33+
[status] 500
34+
35+
content-type: application/json
36+
37+
[Uint8Array (json)]
38+
{
39+
"XAmznErrorType": "com.amazonaws.appconfigdata#InternalServerException",
40+
"Message": "__Message__"
41+
}
42+
43+
44+
--- [error name & message] ---
45+
Unknown: __Message__
46+
47+
--- [error object] ---
48+
{
49+
$fault: "server",
50+
$retryable: (undefined),
51+
$metadata: {
52+
httpStatusCode: (number) 500,
53+
requestId: (undefined),
54+
extendedRequestId: (undefined),
55+
cfId: (undefined),
56+
attempts: (number) 1,
57+
totalRetryDelay: (number) 0
58+
},
59+
name: "Unknown",
60+
XAmznErrorType: "com.amazonaws.appconfigdata#InternalServerException",
61+
message: "__Message__"
62+
}
63+
64+
======================== frontend error ========================
65+
[status] 500
66+
67+
content-type: text/html
68+
69+
[Uint8Array (text)]
70+
An unmodeled error occurred in a front end layer.
71+
72+
73+
--- [error name & message] ---
74+
SyntaxError: Unexpected token 'A', "An unmodel"... is not valid JSON
75+
Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.
76+
77+
--- [error object] ---
78+
{
79+
$metadata: {
80+
httpStatusCode: (number) 500,
81+
requestId: (undefined),
82+
extendedRequestId: (undefined),
83+
cfId: (undefined),
84+
attempts: (number) 1,
85+
totalRetryDelay: (number) 0
86+
}
87+
}
88+
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
======================== minimal response ========================
2+
[status] 404
3+
4+
content-type: application/json
5+
6+
[Uint8Array (json)]
7+
{
8+
"XAmznErrorType": "com.amazonaws.appconfigdata#ResourceNotFoundException"
9+
}
10+
11+
12+
--- [error name & message] ---
13+
Unknown: UnknownError
14+
15+
--- [error object] ---
16+
{
17+
$fault: "client",
18+
$retryable: (undefined),
19+
$metadata: {
20+
httpStatusCode: (number) 404,
21+
requestId: (undefined),
22+
extendedRequestId: (undefined),
23+
cfId: (undefined),
24+
attempts: (number) 1,
25+
totalRetryDelay: (number) 0
26+
},
27+
name: "Unknown",
28+
XAmznErrorType: "com.amazonaws.appconfigdata#ResourceNotFoundException",
29+
message: "UnknownError"
30+
}
31+
32+
======================== w/ optional fields ========================
33+
[status] 404
34+
35+
content-type: application/json
36+
37+
[Uint8Array (json)]
38+
{
39+
"XAmznErrorType": "com.amazonaws.appconfigdata#ResourceNotFoundException",
40+
"Message": "__Message__",
41+
"ResourceType": "__ResourceType__",
42+
"ReferencedBy": {
43+
"key1": "__value__",
44+
"key2": "__value__"
45+
}
46+
}
47+
48+
49+
--- [error name & message] ---
50+
Unknown: __Message__
51+
52+
--- [error object] ---
53+
{
54+
$fault: "client",
55+
$retryable: (undefined),
56+
$metadata: {
57+
httpStatusCode: (number) 404,
58+
requestId: (undefined),
59+
extendedRequestId: (undefined),
60+
cfId: (undefined),
61+
attempts: (number) 1,
62+
totalRetryDelay: (number) 0
63+
},
64+
name: "Unknown",
65+
XAmznErrorType: "com.amazonaws.appconfigdata#ResourceNotFoundException",
66+
ResourceType: "__ResourceType__",
67+
ReferencedBy: {
68+
key1: "__value__",
69+
key2: "__value__"
70+
},
71+
message: "__Message__"
72+
}
73+
74+
======================== frontend error ========================
75+
[status] 500
76+
77+
content-type: text/html
78+
79+
[Uint8Array (text)]
80+
An unmodeled error occurred in a front end layer.
81+
82+
83+
--- [error name & message] ---
84+
SyntaxError: Unexpected token 'A', "An unmodel"... is not valid JSON
85+
Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.
86+
87+
--- [error object] ---
88+
{
89+
$metadata: {
90+
httpStatusCode: (number) 500,
91+
requestId: (undefined),
92+
extendedRequestId: (undefined),
93+
cfId: (undefined),
94+
attempts: (number) 1,
95+
totalRetryDelay: (number) 0
96+
}
97+
}
98+

0 commit comments

Comments
 (0)