From 9989f76ff3dc6128e7c841d81ccc473ce6e1345f Mon Sep 17 00:00:00 2001 From: Amio Date: Wed, 25 Jul 2018 11:30:00 +0800 Subject: [PATCH] chore: update tests for type checking --- test/calc-text-width.spec.js | 5 ----- test/index.spec.js | 6 ++++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/test/calc-text-width.spec.js b/test/calc-text-width.spec.js index c25b9e4..563e32c 100644 --- a/test/calc-text-width.spec.js +++ b/test/calc-text-width.spec.js @@ -22,8 +22,3 @@ tap.test('calc width for emojis', t => { t.matchSnapshot(calcWidth('💩🤱🦄', true), 'result is correct') t.end() }) - -tap.test('exception handling', t => { - t.throws(() => calcWidth(0), TypeError, 'throw if feed with non-string input') - t.end() -}) diff --git a/test/index.spec.js b/test/index.spec.js index 00ececc..56d3cdb 100644 --- a/test/index.spec.js +++ b/test/index.spec.js @@ -42,3 +42,9 @@ tap.test('generate badge with { subject, status, icon, style }', t => { t.matchSnapshot(svg, 'snapshot') t.end() }) + +tap.test('type checking', t => { + t.throws(() => badgen({ status: '' }), TypeError, 'throw if subject is non-string') + t.throws(() => badgen({ subject: '' }), TypeError, 'throw if status is non-string') + t.end() +})