Skip to content

Commit

Permalink
test(middleware-sdk-sqs): use mock credentials in integ test (#5954)
Browse files Browse the repository at this point in the history
  • Loading branch information
kuhe authored Apr 2, 2024
1 parent 43f401b commit 2477e80
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/middleware-sdk-sqs/src/middleware-sdk-sqs.integ.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { SQS } from "@aws-sdk/client-sqs";
import { HttpHandler, HttpResponse } from "@smithy/protocol-http";
import type { AwsCredentialIdentity } from "@smithy/types";
import crypto from "crypto";
import { Readable } from "stream";

Expand Down Expand Up @@ -103,6 +104,11 @@ const handlerResponse = (body: string) => {
};

describe("middleware-sdk-sqs", () => {
const mockCredentials: AwsCredentialIdentity = {
accessKeyId: "integration_test",
secretAccessKey: "integration_test",
};

describe(SQS.name + ` w/ useAwsQuery: ${useAwsQuery}`, () => {
describe("correct md5 hashes", () => {
beforeEach(() => {
Expand All @@ -112,6 +118,7 @@ describe("middleware-sdk-sqs", () => {
it("runs md5 checksums on received messages", async () => {
const client = new SQS({
region: "us-west-2",
credentials: mockCredentials,
requestHandler: new (class implements HttpHandler {
async handle(): Promise<any> {
const r = responses();
Expand All @@ -134,6 +141,7 @@ describe("middleware-sdk-sqs", () => {
it("runs md5 checksums on sent messages", async () => {
const client = new SQS({
region: "us-west-2",
credentials: mockCredentials,
requestHandler: new (class implements HttpHandler {
async handle(): Promise<any> {
const r = responses();
Expand All @@ -157,6 +165,7 @@ describe("middleware-sdk-sqs", () => {
it("runs md5 checksums on batch sent messages", async () => {
const client = new SQS({
region: "us-west-2",
credentials: mockCredentials,
requestHandler: new (class implements HttpHandler {
async handle(): Promise<any> {
const r = responses();
Expand Down Expand Up @@ -199,6 +208,7 @@ describe("middleware-sdk-sqs", () => {
it("runs md5 checksums on received messages", async () => {
const client = new SQS({
region: "us-west-2",
credentials: mockCredentials,
requestHandler: new (class implements HttpHandler {
async handle(): Promise<any> {
const r = responses();
Expand All @@ -224,6 +234,8 @@ describe("middleware-sdk-sqs", () => {

it("runs md5 checksums on sent messages", async () => {
const client = new SQS({
region: "us-west-2",
credentials: mockCredentials,
requestHandler: new (class implements HttpHandler {
async handle(): Promise<any> {
const r = responses();
Expand Down Expand Up @@ -251,6 +263,7 @@ describe("middleware-sdk-sqs", () => {
it("runs md5 checksums on batch sent messages", async () => {
const client = new SQS({
region: "us-west-2",
credentials: mockCredentials,
requestHandler: new (class implements HttpHandler {
async handle(): Promise<any> {
const r = responses();
Expand Down Expand Up @@ -294,6 +307,7 @@ describe("middleware-sdk-sqs", () => {
it("should override resolved endpoint by default", async () => {
const client = new SQS({
region: "us-west-2",
credentials: mockCredentials,
});

requireRequestsFrom(client).toMatch({
Expand All @@ -311,6 +325,7 @@ describe("middleware-sdk-sqs", () => {
it("does not override endpoint if shut off with useQueueUrlAsEndpoint=false", async () => {
const client = new SQS({
region: "us-west-2",
credentials: mockCredentials,
useQueueUrlAsEndpoint: false,
});

Expand All @@ -329,6 +344,7 @@ describe("middleware-sdk-sqs", () => {
it("does not override endpoint if custom endpoint given to client", async () => {
const client = new SQS({
region: "us-west-2",
credentials: mockCredentials,
endpoint: "https://custom-endpoint.com/",
});

Expand Down

0 comments on commit 2477e80

Please sign in to comment.