Skip to content

Commit e09fd1e

Browse files
committed
test(aws-client-api-test): assert client config custody in integ test
1 parent e4d791d commit e09fd1e

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { describe, test as it, expect } from "vitest";
2+
import { S3 } from "@aws-sdk/client-s3";
3+
import { S3Control } from "@aws-sdk/client-s3-control";
4+
import { DynamoDB } from "@aws-sdk/client-dynamodb";
5+
import { EC2 } from "@aws-sdk/client-ec2";
6+
import { SQS } from "@aws-sdk/client-sqs";
7+
import { Glacier } from "@aws-sdk/client-glacier";
8+
import { STS } from "@aws-sdk/client-sts";
9+
import { TranscribeStreaming } from "@aws-sdk/client-transcribe-streaming";
10+
import { Route53 } from "@aws-sdk/client-route-53";
11+
import { RDS } from "@aws-sdk/client-rds";
12+
13+
describe("client config object custody", () => {
14+
it("should maintain a consistent object reference throughout the client resolver stack lifecycle (the constructor)", () => {
15+
const clients = [
16+
new S3(),
17+
new S3Control(),
18+
new DynamoDB(),
19+
new EC2(),
20+
new Glacier(),
21+
new RDS(),
22+
new Route53(),
23+
new SQS(),
24+
new STS(),
25+
new TranscribeStreaming(),
26+
];
27+
for (const client of clients) {
28+
try {
29+
expect(Object.keys(client.config)).toEqual(Object.keys(client.initConfig ?? {}));
30+
} catch (e) {
31+
throw new Error(`MismatchedObjectKeys - config object custody error for ${client.constructor.name}`, {
32+
cause: e,
33+
});
34+
}
35+
36+
// reference equality assertion
37+
try {
38+
expect(client.config).toBe(client.initConfig);
39+
} catch (e) {
40+
throw new Error(`ReferenceEqualityError - config object custody error for ${client.constructor.name}`);
41+
}
42+
}
43+
});
44+
});

0 commit comments

Comments
 (0)