From 80fd73fedc2519998a5227c4407ddeec76ec360c Mon Sep 17 00:00:00 2001 From: Olivier Tardieu Date: Mon, 16 Oct 2017 09:33:04 -0400 Subject: [PATCH] Add seq alias --- composer.js | 4 ++++ test/test.js | 9 +++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/composer.js b/composer.js index b95e871..80bd59d 100644 --- a/composer.js +++ b/composer.js @@ -86,6 +86,10 @@ class Composer { return Array.prototype.map.call(arguments, x => this.task(x), this).reduce(chain) } + seq() { + return this.sequence(...arguments) + } + if(test, consequent, alternate) { if (test == null || consequent == null) throw new ComposerError('Missing arguments in composition', arguments) const id = {} diff --git a/test/test.js b/test/test.js index 2936aa8..b64bacd 100644 --- a/test/test.js +++ b/test/test.js @@ -117,7 +117,7 @@ describe('composer', function () { } catch (error) { assert.equal(error, 'Error: Invalid composition argument') } - }) + }) it('42 must throw', function () { try { @@ -126,7 +126,7 @@ describe('composer', function () { } catch (error) { assert.equal(error, 'Error: Invalid composition argument') } - }) + }) it('{ foo: \'bar\' } must throw', function () { try { @@ -161,6 +161,11 @@ describe('composer', function () { return invoke(composer.sequence(composer.sequence('TripleAndIncrement', 'DivideByTwo'), 'DivideByTwo'), { n: 5 }) .then(activation => assert.deepEqual(activation.response.result, { n: 4 })) }) + + it('seq', function () { + return invoke(composer.seq('TripleAndIncrement', 'DivideByTwo', 'DivideByTwo'), { n: 5 }) + .then(activation => assert.deepEqual(activation.response.result, { n: 4 })) + }) }) describe('if', function () {