]> gerrit.simantics Code Review - simantics/district.git/blob - arguments.js
17ff2ee5988fb9d450878239c1e1c575398af075
[simantics/district.git] / arguments.js
1 var test = require('tap').test
2
3 var vacuum = require('../vacuum.js')
4
5 test('vacuum throws on missing parameters', function (t) {
6   t.throws(vacuum, 'called with no parameters')
7   t.throws(function () { vacuum('directory', {}) }, 'called with no callback')
8
9   t.end()
10 })
11
12 test('vacuum throws on incorrect types ("Forrest is pedantic" section)', function (t) {
13   t.throws(function () {
14     vacuum({}, {}, function () {})
15   }, 'called with path parameter of incorrect type')
16   t.throws(function () {
17     vacuum('directory', 'directory', function () {})
18   }, 'called with options of wrong type')
19   t.throws(function () {
20     vacuum('directory', {}, 'whoops')
21   }, "called with callback that isn't callable")
22
23   t.end()
24 })