Skip to content

Commit

Permalink
fix: step functions use the AWS client set up by sls-test-tools
Browse files Browse the repository at this point in the history
  • Loading branch information
agwhi committed Feb 15, 2022
1 parent 534c20e commit c89d6cd
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"directories": {
"lib": "lib"
},
"repository": "[email protected]:Theodo-UK/sls-test-tools.git",
"repository": "[email protected]: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",
Expand Down
1 change: 1 addition & 0 deletions src/assertions/toContainItemWithValues/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand Down
4 changes: 2 additions & 2 deletions src/assertions/toHaveCompletedExecutionWithStatus/index.ts
Original file line number Diff line number Diff line change
@@ -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<TestResultOutput> {
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(
Expand Down
2 changes: 1 addition & 1 deletion src/assertions/toMatchStateMachineOutput/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import StepFunctions from "../../helpers/stepFunctions";
export default {
async toMatchStateMachineOutput(
stateMachineName: string,
expectedOutput: any
expectedOutput: unknown
): Promise<TestResultOutput> {
const stepFunctions = new AWSStepFunctions();
const stepFunctionObject = await StepFunctions.build();
Expand Down
3 changes: 2 additions & 1 deletion src/helpers/stepFunctions.ts
Original file line number Diff line number Diff line change
@@ -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<void> {
this.stepFunctions = new AWSStepFunctions();
this.stepFunctions = new AWSClient.StepFunctions();
this.allStateMachines = await this.stepFunctions
.listStateMachines()
.promise();
Expand Down

0 comments on commit c89d6cd

Please sign in to comment.