1 |
|
2 |
|
3 |
|
4 |
|
5 | 'use strict';
|
6 |
|
7 | const test = require('tape');
|
8 | const EventEmitter = require('events');
|
9 |
|
10 | const LambdaEngine = require('..');
|
11 |
|
12 | const script = {
|
13 | config: {
|
14 | target: 'my_awesome_function',
|
15 | lambda: {
|
16 | region: 'us-east-1'
|
17 | }
|
18 | },
|
19 | scenarios: [{
|
20 | name: 'Invoke function',
|
21 | engine: 'lambda',
|
22 | flow: [
|
23 | {
|
24 | invoke: {
|
25 | payload: 'A very boring payload'
|
26 | }
|
27 | }
|
28 | ]
|
29 | }]
|
30 | };
|
31 |
|
32 | test('Engine interface', function (t) {
|
33 | const events = new EventEmitter();
|
34 | const engine = new LambdaEngine(script, events, {});
|
35 | const scenario = engine.createScenario(script.scenarios[0], events);
|
36 | t.assert(engine, 'Can construct an engine');
|
37 | t.assert(typeof scenario === 'function', 'Can create a scenario');
|
38 | t.end();
|
39 | });
|