[Pkg-javascript-commits] [node-tap] 30/186: unit test for parse-test-args

Bastien Roucariès rouca at moszumanska.debian.org
Fri Dec 1 16:40:40 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-tap.

commit b7741cb309f76a77298e4d0719c0980588427396
Author: isaacs <i at izs.me>
Date:   Wed Sep 6 09:54:27 2017 -0700

    unit test for parse-test-args
---
 lib/parse-test-args.js  |  1 -
 unit/parse-test-args.js | 25 +++++++++++++++++++++++++
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/lib/parse-test-args.js b/lib/parse-test-args.js
index e180ce9..648afc7 100644
--- a/lib/parse-test-args.js
+++ b/lib/parse-test-args.js
@@ -55,7 +55,6 @@ module.exports = (name_, extra_, cb_, defaultName) => {
   return extra
 }
 
-/* istanbul ignore next */
 const todoCb = () => {
   throw new Error('callback called for TODO test')
 }
diff --git a/unit/parse-test-args.js b/unit/parse-test-args.js
new file mode 100644
index 0000000..4c3e321
--- /dev/null
+++ b/unit/parse-test-args.js
@@ -0,0 +1,25 @@
+'use strict'
+const t = require('../')
+const pta = require('../lib/parse-test-args.js')
+
+const fn = _ => _
+function named () {}
+const todoCb = pta().cb
+
+const cases = [
+  ['foo', {}, fn, null, { name: 'foo', cb: fn }],
+  [undefined, {}, fn, null, { cb: fn }],
+  [{}, named, undefined, undefined, { cb: named, name: 'named' }],
+  [{}, named, false, undefined, { cb: named, name: 'named' }],
+  [named, false, undefined, null, { cb: named, name: 'named' }],
+  ['foo', undefined, undefined, null, { name: 'foo', todo: true, cb: todoCb }],
+  [{name: 'foo'}, fn, undefined, null, { name: 'foo', cb: fn }],
+  [undefined, undefined, undefined, 'def', { name: 'def', todo: true, cb: todoCb }]
+]
+
+cases.forEach(c => t.match(pta(c[0], c[1], c[2], c[3]), c[4]))
+
+t.throws(_ => pta(null),
+  new TypeError('unknown argument passed to parseTestArgs: null'))
+
+t.throws(_ => pta().cb(), new Error('callback called for TODO test'))

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-tap.git



More information about the Pkg-javascript-commits mailing list