UNPKG

959 BJavaScriptView Raw
1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5'use strict';
6
7const test = require('tape');
8const EventEmitter = require('events');
9
10const LambdaEngine = require('..');
11
12const 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
32test('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});