Skip to content

Commit f39bbc1

Browse files
committed
fix: remaining Async function in tests are replaced by pure promise() from aws sdk
1 parent 6ac4503 commit f39bbc1

File tree

4 files changed

+15
-13
lines changed

4 files changed

+15
-13
lines changed

test/scenarios/failed-fn.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ test.serial('Step function Activity Worker with A failing worker', t => {
8181
});
8282

8383
worker.on('success', reject);
84-
stepFunction.startExecutionAsync(params).promise();
84+
stepFunction.startExecution(params).promise();
8585
});
8686
});
8787

test/scenarios/test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ test.serial('Step function Activity Worker with 2 consecutive tasks', t => {
8787
});
8888
});
8989

90-
stepFunction.startExecutionAsync(params).promise();
90+
stepFunction.startExecution(params).promise();
9191
});
9292

93-
stepFunction.startExecutionAsync(params).promise();
93+
stepFunction.startExecution(params).promise();
9494
});
9595
});
9696

@@ -161,9 +161,9 @@ test.serial('Step function with 3 concurrent worker', t => {
161161
worker.on('success', onSuccess);
162162
worker.on('task', onTask);
163163
worker.on('error', reject);
164-
stepFunction.startExecutionAsync(params1).promise();
165-
stepFunction.startExecutionAsync(params2).promise();
166-
stepFunction.startExecutionAsync(params3).promise();
164+
stepFunction.startExecution(params1).promise();
165+
stepFunction.startExecution(params2).promise();
166+
stepFunction.startExecution(params3).promise();
167167
});
168168
});
169169

test/utils/clean-up.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ module.exports = function ({
99
let p1;
1010
let p2;
1111
if (activityArn) {
12-
p1 = stepFunction.deleteActivityAsync({
12+
p1 = stepFunction.deleteActivity({
1313
activityArn
1414
}).promise();
1515
} else {
1616
p1 = Promise.resolve();
1717
}
1818
if (stateMachineArn) {
19-
p2 = stepFunction.deleteStateMachineAsync({
19+
p2 = stepFunction.deleteStateMachine({
2020
stateMachineArn
2121
}).promise();
2222
} else {

test/utils/create-activity.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,21 @@ if (!stateMachineRoleArn) {
2525

2626
module.exports = function ({context = {}, activityName, workerName, stateMachineName}) {
2727
return stepFunction
28-
.createActivityAsync({
28+
.createActivity({
2929
name: activityName
30-
}).promise().bind(context).then(data => {
30+
}).promise().then(data => {
3131
context.activityArn = data.activityArn;
3232
context.workerName = workerName;
3333
}).then(function () {
3434
const params = {
35-
definition: JSON.stringify(stateMachineDefinition({activityArn: this.activityArn})), /* Required */
35+
definition: JSON.stringify(stateMachineDefinition({activityArn: context.activityArn})), /* Required */
3636
name: stateMachineName, /* Required */
3737
roleArn: stateMachineRoleArn /* Required */
3838
};
39-
return stepFunction.createStateMachineAsync(params).promise();
39+
return stepFunction.createStateMachine(params).promise();
4040
}).then(data => {
4141
context.stateMachineArn = data.stateMachineArn;
42-
}).return(context);
42+
}).then(() => {
43+
return context
44+
});
4345
};

0 commit comments

Comments
 (0)