23
23
var tape = require ( 'tape' ) ;
24
24
var hasProp = require ( '@stdlib/assert/has-property' ) ;
25
25
var isFunction = require ( '@stdlib/assert/is-function' ) ;
26
- var namedtypetuple = require ( './../lib' ) ;
26
+ var namedtypedtuple = require ( './../lib' ) ;
27
27
28
28
29
29
// TESTS //
30
30
31
31
tape ( 'main export is a function' , function test ( t ) {
32
32
t . ok ( true , __filename ) ;
33
- t . strictEqual ( typeof namedtypetuple , 'function' , 'main export is a function' ) ;
33
+ t . strictEqual ( typeof namedtypedtuple , 'function' , 'main export is a function' ) ;
34
34
t . end ( ) ;
35
35
} ) ;
36
36
37
37
tape ( 'a tuple has a `forEach` method' , function test ( t ) {
38
38
var Point ;
39
39
var p ;
40
40
41
- Point = namedtypetuple ( [ 'x' , 'y' ] ) ;
41
+ Point = namedtypedtuple ( [ 'x' , 'y' ] ) ;
42
42
p = new Point ( ) ;
43
43
44
- t . strictEqual ( hasProp ( p , 'forEach' ) , true , 'has property ' ) ;
45
- t . strictEqual ( isFunction ( p . forEach ) , true , 'has method ' ) ;
44
+ t . strictEqual ( hasProp ( p , 'forEach' ) , true , 'returns expected value ' ) ;
45
+ t . strictEqual ( isFunction ( p . forEach ) , true , 'returns expected value ' ) ;
46
46
t . end ( ) ;
47
47
} ) ;
48
48
49
- tape ( 'the method throws an error if invoked with a `this` context which is not a namedtypetuple instance' , function test ( t ) {
49
+ tape ( 'the method throws an error if invoked with a `this` context which is not a tuple instance' , function test ( t ) {
50
50
var values ;
51
51
var Point ;
52
52
var p ;
53
53
var i ;
54
54
55
- Point = namedtypetuple ( [ 'x' , 'y' ] ) ;
55
+ Point = namedtypedtuple ( [ 'x' , 'y' ] ) ;
56
56
p = new Point ( [ 1 , 2 ] ) ;
57
57
58
58
values = [
@@ -89,7 +89,7 @@ tape( 'the method throws an error if provided a first argument which is not a fu
89
89
var p ;
90
90
var i ;
91
91
92
- Point = namedtypetuple ( [ 'x' , 'y' ] ) ;
92
+ Point = namedtypedtuple ( [ 'x' , 'y' ] ) ;
93
93
p = new Point ( [ 1 , 2 ] ) ;
94
94
95
95
values = [
@@ -120,15 +120,15 @@ tape( 'the method returns `undefined`', function test( t ) {
120
120
var out ;
121
121
var p ;
122
122
123
- Point = namedtypetuple ( [ 'x' , 'y' ] ) ;
123
+ Point = namedtypedtuple ( [ 'x' , 'y' ] ) ;
124
124
p = new Point ( [ 10 , 20 ] ) ;
125
125
out = p . forEach ( fcn ) ;
126
126
127
127
t . strictEqual ( out , void 0 , 'returns expected value' ) ;
128
128
t . end ( ) ;
129
129
130
130
function fcn ( v ) {
131
- void v ;
131
+ return v ;
132
132
}
133
133
} ) ;
134
134
@@ -145,7 +145,7 @@ tape( 'the method invokes a provided function for each element in a tuple', func
145
145
fieldNames = [ ] ;
146
146
tuples = [ ] ;
147
147
148
- Point = namedtypetuple ( [ 'x' , 'y' , 'z' ] ) ;
148
+ Point = namedtypedtuple ( [ 'x' , 'y' , 'z' ] ) ;
149
149
p = new Point ( [ 1 , 2 , 3 ] ) ;
150
150
p . forEach ( fcn ) ;
151
151
@@ -174,7 +174,7 @@ tape( 'the method supports providing an execution context', function test( t ) {
174
174
ctx = {
175
175
'count' : 0
176
176
} ;
177
- Point = namedtypetuple ( [ 'x' , 'y' , 'z' ] ) ;
177
+ Point = namedtypedtuple ( [ 'x' , 'y' , 'z' ] ) ;
178
178
p = new Point ( [ 1 , 2 , 3 ] ) ;
179
179
p . forEach ( fcn , ctx ) ;
180
180
0 commit comments