-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
55 lines (40 loc) · 1.34 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
'use strict'
const test = require('ava')
const Runner = require('../lib')
test('requires workflow', t => {
t.throws(() => {
const runner = new Runner()
console.log(runner)
}, 'Invalid workflow specified', 'Throws on invalid workflow')
})
test('workflow requires startTaskId', async t => {
const runner = new Runner({})
t.throws(runner.start(), '`startTaskId` must be specified',
'Throws on invalid')
})
test('workflow requires startTask', async t => {
const runner = new Runner({startTaskId: 'a'})
t.throws(runner.start(), 'Invalid workflow - start task not found',
'Throws on invalid')
})
test('All pass', async t => {
const workflow = require('./fixtures/all-pass')
const runner = new Runner(workflow)
const results = await runner.start()
console.log(results)
t.is(results.length, 4, 'Right number of tasks pass')
})
test('All pass - parallel', async t => {
const workflow = require('./fixtures/all-pass-parallel')
const runner = new Runner(workflow)
const results = await runner.start()
console.log(results)
t.is(results.length, 5, 'Right number of tasks pass')
})
test('One failure', async t => {
const workflow = require('./fixtures/one-failure')
const runner = new Runner(workflow)
const results = await runner.start()
console.log(results)
t.is(results.length, 3, 'Right number of tasks pass')
})