Skip to content

Commit

Permalink
fix: accept empty String as issue message
Browse files Browse the repository at this point in the history
  • Loading branch information
pvdlg committed Jun 22, 2018
1 parent 2896c30 commit 34bf9de
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

Expand Down
8 changes: 7 additions & 1 deletion test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
});

0 comments on commit 34bf9de

Please sign in to comment.