Trouble mocking step functions
lj91421 opened this issue · 3 comments
lj91421 commented
I have a function calling stepfunctions.startExecution(params) which i need to mock and the mock i am trying isn't working.
My function:
export const function= async (inputs): Promise<StepFunctions.StartExecutionOutput> => {
const stepfunctions = new StepFunctions();
.
.
.
const params = {
stateMachineArn,
input: inputs,
name: executionName,
};
return stepfunctions.startExecution(params).promise();
};
and my test looks like:
it('should trigger step functions to start', async () => {
const response = 'Step function started';
AWSMock.setSDKInstance(AWS);
AWSMock.mock(stepFunctions, 'startExecution', response);
const result = await issueReport(qualificationId, sessionId, date);
expect(result).toEqual(response);
AWSMock.restore(stepFunctions);
});
Am i doing something wrong?
Packages:
"aws-sdk": "^2.847.0",
"aws-sdk-mock": "^5.1.0",
"jest": "26.6.0",