@@ -6,6 +6,7 @@ describe("bucketHostname", () => {
6
6
const region = "us-west-2" ;
7
7
describe ( "from bucket name" , ( ) => {
8
8
[
9
+ { baseHostname : "s3.dualstack.us-west-2.amazonaws.com" , isCustomEndpoint : false , dualstackEndpoint : true } ,
9
10
{ baseHostname : "s3.us-west-2.amazonaws.com" , isCustomEndpoint : false } ,
10
11
{ baseHostname : "beta.example.com" , isCustomEndpoint : true } ,
11
12
] . forEach ( ( { baseHostname, isCustomEndpoint } ) => {
@@ -187,20 +188,24 @@ describe("bucketHostname", () => {
187
188
188
189
describe ( "from Access Point ARN" , ( ) => {
189
190
describe ( "populates access point endpoint from ARN" , ( ) => {
190
- const s3Hostname = "s3.us-west-2.amazonaws.com" ;
191
191
const customHostname = "example.com" ;
192
192
193
- describe ( `baseHostname: ${ s3Hostname } ` , ( ) => {
194
- const baseHostname = s3Hostname ;
193
+ describe . each ( [
194
+ [ "s3.us-west-2.amazonaws.com" , false ] ,
195
+ [ "s3.dualstack.us-west-2.amazonaws.com" , true ] ,
196
+ ] ) ( `baseHostname: %s, dualstackEndpoint: %s` , ( baseHostname , dualstackEndpoint ) => {
195
197
it ( "should use client region" , ( ) => {
196
198
const { bucketEndpoint, hostname } = bucketHostname ( {
197
199
bucketName : parseArn ( "arn:aws:s3:us-west-2:123456789012:accesspoint:myendpoint" ) ,
198
200
baseHostname,
199
201
isCustomEndpoint : false ,
200
202
clientRegion : region ,
203
+ dualstackEndpoint,
201
204
} ) ;
202
205
expect ( bucketEndpoint ) . toBe ( true ) ;
203
- expect ( hostname ) . toBe ( "myendpoint-123456789012.s3-accesspoint.us-west-2.amazonaws.com" ) ;
206
+ expect ( hostname ) . toBe (
207
+ `myendpoint-123456789012.s3-accesspoint${ dualstackEndpoint ? ".dualstack" : "" } .us-west-2.amazonaws.com`
208
+ ) ;
204
209
} ) ;
205
210
206
211
it ( "should use ARN region" , ( ) => {
@@ -210,9 +215,12 @@ describe("bucketHostname", () => {
210
215
isCustomEndpoint : false ,
211
216
clientRegion : region ,
212
217
useArnRegion : true ,
218
+ dualstackEndpoint,
213
219
} ) ;
214
220
expect ( bucketEndpoint ) . toBe ( true ) ;
215
- expect ( hostname ) . toBe ( "myendpoint-123456789012.s3-accesspoint.us-east-1.amazonaws.com" ) ;
221
+ expect ( hostname ) . toBe (
222
+ `myendpoint-123456789012.s3-accesspoint${ dualstackEndpoint ? ".dualstack" : "" } .us-east-1.amazonaws.com`
223
+ ) ;
216
224
} ) ;
217
225
} ) ;
218
226
0 commit comments