From 34bf9def810c1f29ad1ddd568771305ed15a4c3d Mon Sep 17 00:00:00 2001 From: Pierre Vanduynslager Date: Thu, 21 Jun 2018 21:35:30 -0400 Subject: [PATCH] fix: accept empty String as issue message --- index.js | 2 +- test/index.test.js | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index ac0c4fc..b643ae0 100644 --- a/index.js +++ b/index.js @@ -98,7 +98,7 @@ module.exports = options => { const mentionRegexp = buildMentionRegexp(opts); return text => { - if (!isString(text) || !text.trim()) { + if (!isString(text)) { throw new TypeError('The issue text must be a String'); } diff --git a/test/index.test.js b/test/index.test.js index 5d35985..b526518 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -214,6 +214,13 @@ test('Empty options', t => { ); }); +test('Empty String', t => { + const empty = {actions: [], duplicates: [], mentions: [], refs: []}; + + t.deepEqual(m()(' '), empty); + t.deepEqual(m()(''), empty); +}); + test('Throw TypeError for invalid options', t => { t.throws(() => m([]), TypeError); t.throws(() => m(1), TypeError); @@ -226,5 +233,4 @@ test('Throw TypeError for invalid input', t => { t.throws(() => m()(1), TypeError); t.throws(() => m()({}), TypeError); t.throws(() => m()([]), TypeError); - t.throws(() => m()(''), TypeError); });