Skip to content

Commit 174eab7

Browse files
committed
fix: rm bluebird from test utils
1 parent 51db41f commit 174eab7

File tree

5 files changed

+17
-26
lines changed

5 files changed

+17
-26
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
"homepage": "https://github.com/piercus/step-function-worker#readme",
3232
"devDependencies": {
3333
"ava": "^0.25.0",
34-
"bluebird": "^3.5.0",
3534
"semantic-release": "^15.1.7",
3635
"vows": "^0.8.1",
3736
"winston": "^2.4.1",

test/scenarios/failed-fn.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
const test = require('ava').test;
22
const AWS = require('aws-sdk');
3-
const PromiseBlue = require('bluebird');
43
const winston = require('winston');
54

65
const StepFunctionWorker = require('../../index.js');
76
const createActivity = require('../utils/create-activity');
87
const cleanUp = require('../utils/clean-up');
98

10-
const stepfunction = new AWS.StepFunctions();
11-
const stepFunctionPromises = PromiseBlue.promisifyAll(stepfunction);
9+
const stepFunction = new AWS.StepFunctions();
1210

1311
const logger = new winston.Logger({
1412
transports: [new winston.transports.Console({
@@ -83,7 +81,7 @@ test.serial('Step function Activity Worker with A failing worker', t => {
8381
});
8482

8583
worker.on('success', reject);
86-
stepFunctionPromises.startExecutionAsync(params);
84+
stepFunction.startExecutionAsync(params).promise();
8785
});
8886
});
8987

test/scenarios/test.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
const test = require('ava').test;
2-
const PromiseBlue = require('bluebird');
32
const AWS = require('aws-sdk');
43
const StepFunctionWorker = require('../../index.js');
54
const createActivity = require('../utils/create-activity');
65
const cleanUp = require('../utils/clean-up');
76

8-
const stepfunction = new AWS.StepFunctions();
9-
const stepFunctionPromises = PromiseBlue.promisifyAll(stepfunction);
7+
const stepFunction = new AWS.StepFunctions();
108
const workerName = 'test worker name';
119
const stateMachineName = 'test-state-machine-' + Math.floor(Math.random() * 1000);
1210
const activityName = 'test-step-function-worker-' + Math.floor(Math.random() * 1000);
@@ -89,10 +87,10 @@ test.serial('Step function Activity Worker with 2 consecutive tasks', t => {
8987
});
9088
});
9189

92-
stepFunctionPromises.startExecutionAsync(params);
90+
stepFunction.startExecutionAsync(params).promise();
9391
});
9492

95-
stepFunctionPromises.startExecutionAsync(params);
93+
stepFunction.startExecutionAsync(params).promise();
9694
});
9795
});
9896

@@ -163,9 +161,9 @@ test.serial('Step function with 3 concurrent worker', t => {
163161
worker.on('success', onSuccess);
164162
worker.on('task', onTask);
165163
worker.on('error', reject);
166-
stepFunctionPromises.startExecutionAsync(params1);
167-
stepFunctionPromises.startExecutionAsync(params2);
168-
stepFunctionPromises.startExecutionAsync(params3);
164+
stepFunction.startExecutionAsync(params1).promise();
165+
stepFunction.startExecutionAsync(params2).promise();
166+
stepFunction.startExecutionAsync(params3).promise();
169167
});
170168
});
171169

test/utils/clean-up.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
const PromiseBlue = require('bluebird');
21
const AWS = require('aws-sdk');
32

4-
const stepfunction = new AWS.StepFunctions();
5-
const stepFunctionPromises = PromiseBlue.promisifyAll(stepfunction);
3+
const stepFunction = new AWS.StepFunctions();
64

75
module.exports = function ({
86
activityArn = null,
@@ -11,16 +9,16 @@ module.exports = function ({
119
let p1;
1210
let p2;
1311
if (activityArn) {
14-
p1 = stepFunctionPromises.deleteActivityAsync({
12+
p1 = stepFunction.deleteActivityAsync({
1513
activityArn
16-
});
14+
}).promise();
1715
} else {
1816
p1 = Promise.resolve();
1917
}
2018
if (stateMachineArn) {
21-
p2 = stepFunctionPromises.deleteStateMachineAsync({
19+
p2 = stepFunction.deleteStateMachineAsync({
2220
stateMachineArn
23-
});
21+
}).promise();
2422
} else {
2523
p2 = Promise.resolve();
2624
}

test/utils/create-activity.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
const PromiseBlue = require('bluebird');
21
const AWS = require('aws-sdk');
32

4-
const stepfunction = new AWS.StepFunctions();
5-
const stepFunctionPromises = PromiseBlue.promisifyAll(stepfunction);
3+
const stepFunction = new AWS.StepFunctions();
64

75
const stateMachineDefinition = function (options) {
86
return {
@@ -26,10 +24,10 @@ if (!stateMachineRoleArn) {
2624
}
2725

2826
module.exports = function ({context = {}, activityName, workerName, stateMachineName}) {
29-
return stepFunctionPromises
27+
return stepFunction
3028
.createActivityAsync({
3129
name: activityName
32-
}).bind(context).then(data => {
30+
}).promise().bind(context).then(data => {
3331
context.activityArn = data.activityArn;
3432
context.workerName = workerName;
3533
}).then(function () {
@@ -38,7 +36,7 @@ module.exports = function ({context = {}, activityName, workerName, stateMachine
3836
name: stateMachineName, /* Required */
3937
roleArn: stateMachineRoleArn /* Required */
4038
};
41-
return stepFunctionPromises.createStateMachineAsync(params);
39+
return stepFunction.createStateMachineAsync(params).promise();
4240
}).then(data => {
4341
context.stateMachineArn = data.stateMachineArn;
4442
}).return(context);

0 commit comments

Comments
 (0)