|
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 removes the first Unicode code point of a provided string (ascii)', 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 removes the first Unicode code point of a provided string (Unicode)', function test( t ) { |
63 | | - var out; |
64 | | - |
65 | | - out = removeFirst( 'अनुच्छेद', 1 ); |
66 | | - t.strictEqual( out, 'नुच्छेद', 'returns expected value' ); |
67 | | - |
68 | | - out = removeFirst( '六书/六書', 1 ); |
69 | | - t.strictEqual( out, '书/六書', 'returns expected value' ); |
70 | | - |
71 | | - out = removeFirst( '𐒻𐓟', 1 ); |
72 | | - t.strictEqual( out, '𐓟', 'returns expected value' ); |
73 | | - |
74 | | - out = removeFirst( '\uD800', 1 ); |
75 | | - t.strictEqual( out, '', 'returns expected value' ); |
76 | | - |
77 | | - t.end(); |
78 | | -}); |
79 | | - |
80 | | -tape( 'the function supports removing the first `n` Unicode code points of a provided string', function test( t ) { |
81 | | - var out; |
82 | | - |
83 | | - out = removeFirst( 'hello world', 1 ); |
84 | | - t.strictEqual( out, 'ello world', 'returns expected value' ); |
85 | | - |
86 | | - out = removeFirst( 'hello world', 7 ); |
87 | | - t.strictEqual( out, 'orld', 'returns expected value' ); |
88 | | - |
89 | | - out = removeFirst( '!!!', 1 ); |
90 | | - t.strictEqual( out, '!!', 'returns expected value' ); |
91 | | - |
92 | | - out = removeFirst( '!!!', 2 ); |
93 | | - t.strictEqual( out, '!', 'returns expected value' ); |
94 | | - |
95 | | - out = removeFirst( 'अनुच्छेद', 1 ); |
96 | | - t.strictEqual( out, 'नुच्छेद', 'returns expected value' ); |
97 | | - |
98 | | - out = removeFirst( '六书/六書', 3 ); |
99 | | - t.strictEqual( out, '六書', 'returns expected value' ); |
100 | | - |
101 | | - out = removeFirst( '𐓟𐒻𐓟', 2 ); |
102 | | - t.strictEqual( out, '𐓟', 'returns expected value' ); |
103 | | - |
| 31 | + t.strictEqual( main !== void 0, true, 'main export is defined' ); |
104 | 32 | t.end(); |
105 | 33 | }); |
0 commit comments