-
-
Notifications
You must be signed in to change notification settings - Fork 809
/
Copy pathtest.js
43 lines (30 loc) · 998 Bytes
/
test.js
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
38
39
40
41
42
43
'use strict';
// MODULES //
var tape = require( 'tape' );
var isFunctionArray = require( './../lib' );
// TESTS //
tape( 'main export is a function', function test( t ) {
t.ok( true, __filename );
t.strictEqual( typeof isFunctionArray, 'function', 'main export is a function' );
t.end();
});
tape( 'the function tests if a value is an array of functions', function test( t ) {
var bool;
var arr;
function beep(){}
function boop(){}
arr = [ beep, boop ];
bool = isFunctionArray( arr );
t.strictEqual( bool, true, 'returns true' );
arr = [ beep, null ];
bool = isFunctionArray( arr );
t.strictEqual( bool, false, 'returns false' );
arr = [];
bool = isFunctionArray( arr );
t.strictEqual( bool, false, 'returns false when provided an empty array' );
bool = isFunctionArray( null );
t.strictEqual( bool, false, 'returns false when provided a null' );
bool = isFunctionArray( beep );
t.strictEqual( bool, false, 'returns false when provided a function' );
t.end();
});