Skip to content

Commit

Permalink
chore: fix type errors in integ tests (#6054)
Browse files Browse the repository at this point in the history
  • Loading branch information
kuhe committed May 2, 2024
1 parent 003de3f commit 94d4a10
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,16 @@ jest.mock("@aws-sdk/client-sso", () => {
};
});

let stsSpy: jest.Spied<any> | any | undefined = undefined;
// This var must be hoisted.
// eslint-disable-next-line no-var
var stsSpy: jest.Spied<any> | any | undefined = undefined;

jest.mock("@aws-sdk/client-sts", () => {
const actual = jest.requireActual("@aws-sdk/client-sts");

const originalSend = actual.STSClient.prototype.send;

stsSpy = jest.spyOn(actual.STSClient.prototype, "send").mockImplementation(async function (command: any) {
stsSpy = jest.spyOn(actual.STSClient.prototype, "send").mockImplementation(async function (this: any, command: any) {
if (command.constructor.name === "AssumeRoleCommand") {
return {
Credentials: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe("middleware-eventstream", () => {
[Symbol.asyncIterator]() {
return {
next() {
return this;
return this as any;
},
};
},
Expand Down Expand Up @@ -57,7 +57,7 @@ describe("middleware-eventstream", () => {
[Symbol.asyncIterator]() {
return {
next() {
return this;
return this as any;
},
};
},
Expand Down Expand Up @@ -87,7 +87,7 @@ describe("middleware-eventstream", () => {
[Symbol.asyncIterator]() {
return {
next() {
return this;
return this as any;
},
};
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import type { AwsCredentialIdentity } from "@smithy/types";
import crypto from "crypto";
import { Readable } from "stream";

import sqsModel from "../../../codegen/sdk-codegen/aws-models/sqs.json";
import { requireRequestsFrom } from "../../../private/aws-util-test/src";

const sqsModel: any = require("../../../codegen/sdk-codegen/aws-models/sqs.json");
const useAwsQuery = !!sqsModel.shapes["com.amazonaws.sqs#AmazonSQS"].traits["aws.protocols#awsQuery"];

let hashError = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe("middleware-sdk-transcribe-streaming", () => {
MediaEncoding: "pcm",
AudioStream: {
[Symbol.asyncIterator]() {
return this;
return this as any;
},
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe("middleware-websocket", () => {
ChallengeVersions: "a,b,c",
LivenessRequestStream: {
[Symbol.asyncIterator]() {
return this;
return this as any;
},
},
});
Expand Down

0 comments on commit 94d4a10

Please sign in to comment.