-
-
Notifications
You must be signed in to change notification settings - Fork 804
/
Copy pathtest.js
51 lines (34 loc) · 1.2 KB
/
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
44
45
46
47
48
49
50
51
'use strict';
// MODULES //
var tape = require( 'tape' );
var isStringArray = require( './../lib' );
// TESTS //
tape( 'main export is a function', function test( t ) {
t.ok( true, __filename );
t.equal( typeof isStringArray, 'function', 'main export is a function' );
t.end();
});
tape( 'the function tests for an array of `string` values', function test( t ) {
var arr;
arr = [ 'a', new String( 'b' ) ];
t.equal( isStringArray( arr ), true, 'returns true' );
arr = [ 'a', 5, null ];
t.equal( isStringArray( arr ), false, 'returns false' );
t.end();
});
tape( 'the function provides a method to test for an array of `string` primitives', function test( t ) {
var arr;
arr = [ 'a', 'b' ];
t.equal( isStringArray.primitives( arr ), true, 'returns true' );
arr = [ new String( 'a' ), 'b' ];
t.equal( isStringArray.primitives( arr ), false, 'returns false' );
t.end();
});
tape( 'the function provides a method to test for an array of `String` objects', function test( t ) {
var arr;
arr = [ new String( 'a' ), new String( 'b' ) ];
t.equal( isStringArray.objects( arr ), true, 'returns true' );
arr = [ 'a', 'b' ];
t.equal( isStringArray.objects( arr ), false, 'returns false' );
t.end();
});