1
1
import { SQS } from "@aws-sdk/client-sqs" ;
2
2
import { HttpHandler , HttpResponse } from "@smithy/protocol-http" ;
3
+ import type { AwsCredentialIdentity } from "@smithy/types" ;
3
4
import crypto from "crypto" ;
4
5
import { Readable } from "stream" ;
5
6
@@ -103,6 +104,11 @@ const handlerResponse = (body: string) => {
103
104
} ;
104
105
105
106
describe ( "middleware-sdk-sqs" , ( ) => {
107
+ const mockCredentials : AwsCredentialIdentity = {
108
+ accessKeyId : "integration_test" ,
109
+ secretAccessKey : "integration_test" ,
110
+ } ;
111
+
106
112
describe ( SQS . name + ` w/ useAwsQuery: ${ useAwsQuery } ` , ( ) => {
107
113
describe ( "correct md5 hashes" , ( ) => {
108
114
beforeEach ( ( ) => {
@@ -112,6 +118,7 @@ describe("middleware-sdk-sqs", () => {
112
118
it ( "runs md5 checksums on received messages" , async ( ) => {
113
119
const client = new SQS ( {
114
120
region : "us-west-2" ,
121
+ credentials : mockCredentials ,
115
122
requestHandler : new ( class implements HttpHandler {
116
123
async handle ( ) : Promise < any > {
117
124
const r = responses ( ) ;
@@ -134,6 +141,7 @@ describe("middleware-sdk-sqs", () => {
134
141
it ( "runs md5 checksums on sent messages" , async ( ) => {
135
142
const client = new SQS ( {
136
143
region : "us-west-2" ,
144
+ credentials : mockCredentials ,
137
145
requestHandler : new ( class implements HttpHandler {
138
146
async handle ( ) : Promise < any > {
139
147
const r = responses ( ) ;
@@ -157,6 +165,7 @@ describe("middleware-sdk-sqs", () => {
157
165
it ( "runs md5 checksums on batch sent messages" , async ( ) => {
158
166
const client = new SQS ( {
159
167
region : "us-west-2" ,
168
+ credentials : mockCredentials ,
160
169
requestHandler : new ( class implements HttpHandler {
161
170
async handle ( ) : Promise < any > {
162
171
const r = responses ( ) ;
@@ -199,6 +208,7 @@ describe("middleware-sdk-sqs", () => {
199
208
it ( "runs md5 checksums on received messages" , async ( ) => {
200
209
const client = new SQS ( {
201
210
region : "us-west-2" ,
211
+ credentials : mockCredentials ,
202
212
requestHandler : new ( class implements HttpHandler {
203
213
async handle ( ) : Promise < any > {
204
214
const r = responses ( ) ;
@@ -224,6 +234,8 @@ describe("middleware-sdk-sqs", () => {
224
234
225
235
it ( "runs md5 checksums on sent messages" , async ( ) => {
226
236
const client = new SQS ( {
237
+ region : "us-west-2" ,
238
+ credentials : mockCredentials ,
227
239
requestHandler : new ( class implements HttpHandler {
228
240
async handle ( ) : Promise < any > {
229
241
const r = responses ( ) ;
@@ -251,6 +263,7 @@ describe("middleware-sdk-sqs", () => {
251
263
it ( "runs md5 checksums on batch sent messages" , async ( ) => {
252
264
const client = new SQS ( {
253
265
region : "us-west-2" ,
266
+ credentials : mockCredentials ,
254
267
requestHandler : new ( class implements HttpHandler {
255
268
async handle ( ) : Promise < any > {
256
269
const r = responses ( ) ;
@@ -294,6 +307,7 @@ describe("middleware-sdk-sqs", () => {
294
307
it ( "should override resolved endpoint by default" , async ( ) => {
295
308
const client = new SQS ( {
296
309
region : "us-west-2" ,
310
+ credentials : mockCredentials ,
297
311
} ) ;
298
312
299
313
requireRequestsFrom ( client ) . toMatch ( {
@@ -311,6 +325,7 @@ describe("middleware-sdk-sqs", () => {
311
325
it ( "does not override endpoint if shut off with useQueueUrlAsEndpoint=false" , async ( ) => {
312
326
const client = new SQS ( {
313
327
region : "us-west-2" ,
328
+ credentials : mockCredentials ,
314
329
useQueueUrlAsEndpoint : false ,
315
330
} ) ;
316
331
@@ -329,6 +344,7 @@ describe("middleware-sdk-sqs", () => {
329
344
it ( "does not override endpoint if custom endpoint given to client" , async ( ) => {
330
345
const client = new SQS ( {
331
346
region : "us-west-2" ,
347
+ credentials : mockCredentials ,
332
348
endpoint : "https://custom-endpoint.com/" ,
333
349
} ) ;
334
350
0 commit comments