|
21 | 21 | // MODULES // |
22 | 22 |
|
23 | 23 | var tape = require( 'tape' ); |
24 | | -var removeFirst = require( './../../dist' ); |
| 24 | +var main = require( './../../dist' ); |
25 | 25 |
|
26 | 26 |
|
27 | 27 | // TESTS // |
28 | 28 |
|
29 | | -tape( 'main export is a function', function test( t ) { |
| 29 | +tape( 'main export is defined', function test( t ) { |
30 | 30 | t.ok( true, __filename ); |
31 | | - t.strictEqual( typeof removeFirst, 'function', 'main export is a function' ); |
32 | | - t.end(); |
33 | | -}); |
34 | | - |
35 | | -tape( 'the function returns an empty string if provided an empty string', function test( t ) { |
36 | | - t.strictEqual( removeFirst( '', 1 ), '', 'returns expected value' ); |
37 | | - t.strictEqual( removeFirst( '', 2 ), '', 'returns expected value' ); |
38 | | - t.strictEqual( removeFirst( '', 3 ), '', 'returns expected value' ); |
39 | | - t.end(); |
40 | | -}); |
41 | | - |
42 | | -tape( 'the function returns the input string if provided zero as the second argument', function test( t ) { |
43 | | - t.strictEqual( removeFirst( 'hello world', 0 ), 'hello world', 'returns expected value' ); |
44 | | - t.end(); |
45 | | -}); |
46 | | - |
47 | | -tape( 'the function returns the string without the first UTF-16 code unit', function test( t ) { |
48 | | - var out; |
49 | | - |
50 | | - out = removeFirst( 'hello world', 1 ); |
51 | | - t.strictEqual( out, 'ello world', 'returns expected value' ); |
52 | | - |
53 | | - out = removeFirst( '!!!', 1 ); |
54 | | - t.strictEqual( out, '!!', 'returns expected value' ); |
55 | | - |
56 | | - out = removeFirst( 'Hello World', 1 ); |
57 | | - t.strictEqual( out, 'ello World', 'returns expected value' ); |
58 | | - |
59 | | - t.end(); |
60 | | -}); |
61 | | - |
62 | | -tape( 'the function supports removing the first `n` UTF-16 code units of a provided string', function test( t ) { |
63 | | - var out; |
64 | | - |
65 | | - out = removeFirst( 'hello world', 1 ); |
66 | | - t.strictEqual( out, 'ello world', 'returns expected value' ); |
67 | | - |
68 | | - out = removeFirst( 'hello world', 7 ); |
69 | | - t.strictEqual( out, 'orld', 'returns expected value' ); |
70 | | - |
71 | | - out = removeFirst( '!!!', 1 ); |
72 | | - t.strictEqual( out, '!!', 'returns expected value' ); |
73 | | - |
74 | | - out = removeFirst( '!!!', 2 ); |
75 | | - t.strictEqual( out, '!', 'returns expected value' ); |
76 | | - |
| 31 | + t.strictEqual( main !== void 0, true, 'main export is defined' ); |
77 | 32 | t.end(); |
78 | 33 | }); |
0 commit comments