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
@@ -40,7 +40,7 @@ tape( 'the method throws an error if invoked with a `this` context which is not
40
40
var p ;
41
41
var i ;
42
42
43
- Point = namedtypetuple ( [ 'x' , 'y' ] ) ;
43
+ Point = namedtypedtuple ( [ 'x' , 'y' ] ) ;
44
44
p = new Point ( ) ;
45
45
46
46
values = [
@@ -70,11 +70,11 @@ tape( 'a tuple has a `toLocaleString` method', function test( t ) {
70
70
var Point ;
71
71
var p ;
72
72
73
- Point = namedtypetuple ( [ 'x' , 'y' ] ) ;
73
+ Point = namedtypedtuple ( [ 'x' , 'y' ] ) ;
74
74
p = new Point ( ) ;
75
75
76
- t . strictEqual ( hasProp ( p , 'toLocaleString' ) , true , 'has property ' ) ;
77
- t . strictEqual ( isFunction ( p . toLocaleString ) , true , 'is a function ' ) ;
76
+ t . strictEqual ( hasProp ( p , 'toLocaleString' ) , true , 'returns expected value ' ) ;
77
+ t . strictEqual ( isFunction ( p . toLocaleString ) , true , 'returns expected value ' ) ;
78
78
t . end ( ) ;
79
79
} ) ;
80
80
@@ -84,13 +84,13 @@ tape( 'the method serializes a tuple as a locale-specific string (default locale
84
84
var Point ;
85
85
var p ;
86
86
87
- Point = namedtypetuple ( [ 'price' , 'quantity' ] ) ;
87
+ Point = namedtypedtuple ( [ 'price' , 'quantity' ] ) ;
88
88
p = new Point ( [ 123456.789 , 9876 ] ) ;
89
89
90
90
expected = 'tuple(price=' + ( 123456.789 ) . toLocaleString ( ) + ', quantity=' + ( 9876 ) . toLocaleString ( ) + ')' ;
91
91
actual = p . toLocaleString ( ) ;
92
92
93
- t . strictEqual ( actual , expected , 'returns expected string ' ) ;
93
+ t . strictEqual ( actual , expected , 'returns expected value ' ) ;
94
94
t . end ( ) ;
95
95
} ) ;
96
96
@@ -100,13 +100,13 @@ tape( 'the method serializes a tuple as a locale-specific string (specified loca
100
100
var Point ;
101
101
var p ;
102
102
103
- Point = namedtypetuple ( [ 'price' , 'quantity' ] ) ;
103
+ Point = namedtypedtuple ( [ 'price' , 'quantity' ] ) ;
104
104
p = new Point ( [ 123456.789 , 9876 ] ) ;
105
105
106
106
expected = 'tuple(price=123.456,789, quantity=9.876)' ;
107
107
actual = p . toLocaleString ( 'de-DE' ) ;
108
108
109
- t . strictEqual ( actual , expected , 'returns expected string for German locale ' ) ;
109
+ t . strictEqual ( actual , expected , 'returns expected value ' ) ;
110
110
t . end ( ) ;
111
111
} ) ;
112
112
@@ -117,7 +117,7 @@ tape( 'the method serializes a tuple as a locale-specific string (locale and opt
117
117
var opts ;
118
118
var p ;
119
119
120
- Point = namedtypetuple ( [ 'price' , 'quantity' ] ) ;
120
+ Point = namedtypedtuple ( [ 'price' , 'quantity' ] ) ;
121
121
p = new Point ( [ 1234.56 , 50 ] ) ;
122
122
opts = {
123
123
'style' : 'currency' ,
@@ -127,7 +127,7 @@ tape( 'the method serializes a tuple as a locale-specific string (locale and opt
127
127
expected = 'tuple(price=' + ( 1234.56 ) . toLocaleString ( 'en-US' , opts ) + ', quantity=' + ( 50 ) . toLocaleString ( 'en-US' , opts ) + ')' ;
128
128
actual = p . toLocaleString ( 'en-US' , opts ) ;
129
129
130
- t . strictEqual ( actual , expected , 'returns expected string for currency format ' ) ;
130
+ t . strictEqual ( actual , expected , 'returns expected value ' ) ;
131
131
t . end ( ) ;
132
132
} ) ;
133
133
@@ -137,13 +137,12 @@ tape( 'the method handles NaN values', function test( t ) {
137
137
var actual ;
138
138
var r ;
139
139
140
- Record = namedtypetuple ( [ 'isValid' , 'value' ] ) ;
140
+ Record = namedtypedtuple ( [ 'isValid' , 'value' ] ) ;
141
141
r = new Record ( [ 1 , NaN ] ) ;
142
142
143
143
expected = 'tuple(isValid=1, value=NaN)' ;
144
144
actual = r . toLocaleString ( ) ;
145
145
146
- t . strictEqual ( actual , expected , 'handles boolean and NaN values ' ) ;
146
+ t . strictEqual ( actual , expected , 'returns expected value ' ) ;
147
147
t . end ( ) ;
148
148
} ) ;
149
-
0 commit comments