summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/async-some/test/parameters.js
blob: 0706d1da6fc6280dd29e2c688bad504b8f89f6c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
var test = require("tap").test

var some = require("../some.js")

var NOP = function () {}

test("some() called with bogus parameters", function (t) {
  t.throws(function () {
    some()
  }, "throws when called with no parameters")

  t.throws(function () {
    some(null, NOP, NOP)
  }, "throws when called with no list")

  t.throws(function () {
    some([], null, NOP)
  }, "throws when called with no predicate")

  t.throws(function () {
    some([], NOP, null)
  }, "throws when called with no callback")

  t.throws(function () {
    some({}, NOP, NOP)
  }, "throws when called with wrong list type")

  t.throws(function () {
    some([], "ham", NOP)
  }, "throws when called with wrong test type")

  t.throws(function () {
    some([], NOP, "ham")
  }, "throws when called with wrong test type")

  t.end()
})