From 6d727adb72bc06f829a2c022b7c92a599bc70160 Mon Sep 17 00:00:00 2001 From: Matias Dominguez Date: Wed, 3 Oct 2018 00:49:52 -0300 Subject: [PATCH 1/2] Add default case in sortArguments --- src/app/util/sortArguments.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/app/util/sortArguments.js b/src/app/util/sortArguments.js index f7f0b06..6a89c07 100644 --- a/src/app/util/sortArguments.js +++ b/src/app/util/sortArguments.js @@ -72,6 +72,10 @@ const sortArguments = (reqArguments) => { costs.push('paid'); break; } + + default: { + break; + } } }); let returnArgs = {}; From a4a862fd8e6607956b39be57534c5ae5b6165f07 Mon Sep 17 00:00:00 2001 From: Matias Dominguez Date: Wed, 3 Oct 2018 01:04:33 -0300 Subject: [PATCH 2/2] Add test for default argument sorter test --- test/incomingParser.test.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/incomingParser.test.js b/test/incomingParser.test.js index 6aad7cd..282c947 100644 --- a/test/incomingParser.test.js +++ b/test/incomingParser.test.js @@ -103,6 +103,13 @@ describe('parsePayload()', function () { expect(res.actionArguments).to.eql({ 'language': ['python'] }); }); + + it('should return nothing', async function () { + req.body.text = 'cats are awesome'; + const res = await parsePayload(req); + + expect(res.actionArguments).to.be.empty; + }); }); describe('when invoked with level as arguments', function () {