From c89d6cdf877698662d0fe57fe27e66b83f64fdc1 Mon Sep 17 00:00:00 2001 From: agwhi Date: Tue, 15 Feb 2022 10:55:08 +0000 Subject: [PATCH] fix: step functions use the AWS client set up by sls-test-tools --- package.json | 8 ++++---- src/assertions/toContainItemWithValues/index.ts | 1 + .../toHaveCompletedExecutionWithStatus/index.ts | 4 ++-- src/assertions/toMatchStateMachineOutput/index.ts | 2 +- src/helpers/stepFunctions.ts | 3 ++- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 3d2846d..a3ce64e 100644 --- a/package.json +++ b/package.json @@ -8,12 +8,12 @@ "directories": { "lib": "lib" }, - "repository": "git@github.com:Theodo-UK/sls-test-tools.git", + "repository": "git@github.com:aleios-cloud/sls-test-tools.git", "bugs": { - "url": "https://github.com/Theodo-UK/sls-test-tools/issues" + "url": "https://github.com/aleios-cloud/sls-test-tools/issues" }, - "homepage": "https://github.com/Theodo-UK/sls-test-tools#readme", - "author": "Theodo UK", + "homepage": "https://github.com/aleios-cloud/sls-test-tools#readme", + "author": "Aleios", "license": "MIT", "scripts": { "build": "rm -rf lib && yarn package:cjs && yarn package:esm && yarn package:types", diff --git a/src/assertions/toContainItemWithValues/index.ts b/src/assertions/toContainItemWithValues/index.ts index efaf29b..781d6b1 100644 --- a/src/assertions/toContainItemWithValues/index.ts +++ b/src/assertions/toContainItemWithValues/index.ts @@ -23,6 +23,7 @@ export default { Object.entries(values).forEach(([key, val]) => { if (result.Item?.[key] !== val) { return testResult( + // eslint-disable-next-line @typescript-eslint/restrict-template-expressions `Item was expected to have ${key} value of ${val}, but instead had ${key} value of ${result.Item?.[key]}`, false ); diff --git a/src/assertions/toHaveCompletedExecutionWithStatus/index.ts b/src/assertions/toHaveCompletedExecutionWithStatus/index.ts index fbe7904..ceda8d2 100644 --- a/src/assertions/toHaveCompletedExecutionWithStatus/index.ts +++ b/src/assertions/toHaveCompletedExecutionWithStatus/index.ts @@ -1,14 +1,14 @@ import { testResult, TestResultOutput } from "../../utils/testResult"; import StepFunctions from "../../helpers/stepFunctions"; -import * as AWS from "aws-sdk"; +import { AWSClient } from "../../helpers/general"; export default { async toHaveCompletedExecutionWithStatus( stateMachineName: string, expectedStatus: string ): Promise { - const stepFunctions: AWS.StepFunctions = new AWS.StepFunctions(); + const stepFunctions = new AWSClient.StepFunctions(); const stepFunctionsObject = await StepFunctions.build(); // Helper to get stateMachine ARN from stateMachine name const smArn = await stepFunctionsObject.obtainStateMachineArn( diff --git a/src/assertions/toMatchStateMachineOutput/index.ts b/src/assertions/toMatchStateMachineOutput/index.ts index fd4f7ff..d1a5455 100644 --- a/src/assertions/toMatchStateMachineOutput/index.ts +++ b/src/assertions/toMatchStateMachineOutput/index.ts @@ -5,7 +5,7 @@ import StepFunctions from "../../helpers/stepFunctions"; export default { async toMatchStateMachineOutput( stateMachineName: string, - expectedOutput: any + expectedOutput: unknown ): Promise { const stepFunctions = new AWSStepFunctions(); const stepFunctionObject = await StepFunctions.build(); diff --git a/src/helpers/stepFunctions.ts b/src/helpers/stepFunctions.ts index b0ea362..ee4e7b3 100644 --- a/src/helpers/stepFunctions.ts +++ b/src/helpers/stepFunctions.ts @@ -1,11 +1,12 @@ import { StepFunctions as AWSStepFunctions } from "aws-sdk"; +import { AWSClient } from "./general"; export default class StepFunctions { stepFunctions: AWSStepFunctions | undefined; allStateMachines: AWSStepFunctions.ListStateMachinesOutput | undefined; async init(): Promise { - this.stepFunctions = new AWSStepFunctions(); + this.stepFunctions = new AWSClient.StepFunctions(); this.allStateMachines = await this.stepFunctions .listStateMachines() .promise();