Skip to content

Commit cbe3bba

Browse files
committed
fix(middleware-bucket-endpoint): add tests
1 parent f8c1b62 commit cbe3bba

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

packages/middleware-bucket-endpoint/src/bucketHostname.spec.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ describe("bucketHostname", () => {
393393
[
394394
{
395395
bucketArn: "arn:aws:sqs:us-west-2:123456789012:someresource",
396-
message: "Expect 's3' or 's3-outposts' in ARN service component",
396+
message: "Expect 's3' or 's3-outposts' or 's3-object-lambda' in ARN service component",
397397
},
398398
{
399399
bucketArn: "arn:aws:s3:us-west-2:123456789012:bucket_name:mybucket",
@@ -713,4 +713,23 @@ describe("bucketHostname", () => {
713713
expect(signingService).toBe("s3-outposts");
714714
});
715715
});
716+
717+
describe("from Object Lamdba ARN", () => {
718+
describe("populates access point endpoint from ARN", () => {
719+
it("should use the proper endpoint", () => {
720+
const region = "eu-west-1";
721+
const expectedEndpoint = "js-sdk-ap-name-123456789012.s3-object-lambda.eu-west-1.amazonaws.com";
722+
["arn:aws:s3-object-lambda:eu-west-1:123456789012:accesspoint/js-sdk-ap-name"].forEach((outpostArn) => {
723+
const { bucketEndpoint, hostname } = bucketHostname({
724+
bucketName: parseArn(outpostArn),
725+
baseHostname: "s3.eu-west-1.amazonaws.com",
726+
isCustomEndpoint: false,
727+
clientRegion: region,
728+
});
729+
expect(bucketEndpoint).toBe(true);
730+
expect(hostname).toBe(expectedEndpoint);
731+
});
732+
});
733+
});
734+
});
716735
});

0 commit comments

Comments
 (0)