1
1
const test = require ( 'ava' ) . test ;
2
- const AWS = require ( 'aws-sdk' ) ;
3
- const PromiseBlue = require ( 'bluebird' ) ;
4
2
const winston = require ( 'winston' ) ;
5
3
6
4
const StepFunctionWorker = require ( '../../index.js' ) ;
7
5
const createActivity = require ( '../utils/create-activity' ) ;
8
6
const cleanUp = require ( '../utils/clean-up' ) ;
9
7
10
- const stepfunction = new AWS . StepFunctions ( ) ;
11
- const stepFunctionPromises = PromiseBlue . promisifyAll ( stepfunction ) ;
12
-
13
8
const logger = new winston . Logger ( {
14
9
transports : [ new winston . transports . Console ( {
15
10
level : 'debug'
@@ -36,12 +31,9 @@ const context = {};
36
31
const before = createActivity . bind ( null , { context, activityName, stateMachineName, workerName} ) ;
37
32
const after = cleanUp . bind ( null , { context, activityName, stateMachineName, workerName} ) ;
38
33
39
- const sentInput = { foo : 'bar' } ;
40
-
41
34
const fn = function ( event , callback , heartbeat ) {
42
35
heartbeat ( ) ;
43
36
setTimeout ( ( ) => {
44
- const err = new Error ( 'custom error' ) ;
45
37
// Assert.equal(event, sentInput);
46
38
callback ( null , event ) ;
47
39
} , 2000 ) ;
@@ -51,13 +43,12 @@ test.before(before);
51
43
52
44
test . serial ( 'Step function Activity Workerhas a ready event' , t => {
53
45
const activityArn = context . activityArn ;
54
- const stateMachineArn = context . stateMachineArn ;
55
46
56
47
return new Promise ( ( resolve , reject ) => {
57
48
const worker = new StepFunctionWorker ( {
58
49
activityArn,
59
50
workerName : workerName + '-fn' ,
60
- fn : fn ,
51
+ fn,
61
52
logger
62
53
} ) ;
63
54
let ready = false ;
@@ -66,14 +57,13 @@ test.serial('Step function Activity Workerhas a ready event', t => {
66
57
ready = true ;
67
58
resolve ( ) ;
68
59
} ) ;
69
-
70
- setTimeout ( function ( ) {
71
- if ( ! ready ) {
60
+
61
+ setTimeout ( ( ) => {
62
+ if ( ! ready ) {
72
63
t . fail ( ) ;
73
64
reject ( ) ;
74
65
}
75
- } , 1000 )
76
-
66
+ } , 1000 ) ;
77
67
} ) ;
78
68
} ) ;
79
69
0 commit comments