9
9
isBoolean ,
10
10
isString ,
11
11
isNumber ,
12
+ isNumeric ,
12
13
isPrimitive ,
13
14
isDate ,
14
15
isEvent ,
@@ -17,7 +18,7 @@ import {
17
18
} from './inspect'
18
19
19
20
describe ( 'utils/inspect' , ( ) => {
20
- it ( 'toType' , async ( ) => {
21
+ it ( 'toType() ' , async ( ) => {
21
22
expect ( toType ( 123 ) ) . toEqual ( 'number' )
22
23
expect ( toType ( '123' ) ) . toEqual ( 'string' )
23
24
expect ( toType ( true ) ) . toEqual ( 'boolean' )
@@ -31,7 +32,7 @@ describe('utils/inspect', () => {
31
32
expect ( toType ( null ) ) . toEqual ( 'object' )
32
33
} )
33
34
34
- it ( 'toRawType' , async ( ) => {
35
+ it ( 'toRawType() ' , async ( ) => {
35
36
expect ( toRawType ( 123 ) ) . toEqual ( 'Number' )
36
37
expect ( toRawType ( '123' ) ) . toEqual ( 'String' )
37
38
expect ( toRawType ( true ) ) . toEqual ( 'Boolean' )
@@ -45,7 +46,7 @@ describe('utils/inspect', () => {
45
46
expect ( toRawType ( null ) ) . toEqual ( 'Null' )
46
47
} )
47
48
48
- it ( 'toRawTypeLC' , async ( ) => {
49
+ it ( 'toRawTypeLC() ' , async ( ) => {
49
50
expect ( toRawTypeLC ( 123 ) ) . toEqual ( 'number' )
50
51
expect ( toRawTypeLC ( '123' ) ) . toEqual ( 'string' )
51
52
expect ( toRawTypeLC ( true ) ) . toEqual ( 'boolean' )
@@ -59,7 +60,7 @@ describe('utils/inspect', () => {
59
60
expect ( toRawTypeLC ( null ) ) . toEqual ( 'null' )
60
61
} )
61
62
62
- it ( 'isUndefined' , async ( ) => {
63
+ it ( 'isUndefined() ' , async ( ) => {
63
64
expect ( isUndefined ( 123 ) ) . toEqual ( false )
64
65
expect ( isUndefined ( '123' ) ) . toEqual ( false )
65
66
expect ( isUndefined ( true ) ) . toEqual ( false )
@@ -73,7 +74,7 @@ describe('utils/inspect', () => {
73
74
expect ( isUndefined ( null ) ) . toEqual ( false )
74
75
} )
75
76
76
- it ( 'isNull' , async ( ) => {
77
+ it ( 'isNull() ' , async ( ) => {
77
78
expect ( isNull ( 123 ) ) . toEqual ( false )
78
79
expect ( isNull ( '123' ) ) . toEqual ( false )
79
80
expect ( isNull ( true ) ) . toEqual ( false )
@@ -87,7 +88,7 @@ describe('utils/inspect', () => {
87
88
expect ( isNull ( null ) ) . toEqual ( true )
88
89
} )
89
90
90
- it ( 'isUndefinedOrNull' , async ( ) => {
91
+ it ( 'isUndefinedOrNull() ' , async ( ) => {
91
92
expect ( isUndefinedOrNull ( 123 ) ) . toEqual ( false )
92
93
expect ( isUndefinedOrNull ( '123' ) ) . toEqual ( false )
93
94
expect ( isUndefinedOrNull ( true ) ) . toEqual ( false )
@@ -101,7 +102,7 @@ describe('utils/inspect', () => {
101
102
expect ( isUndefinedOrNull ( null ) ) . toEqual ( true )
102
103
} )
103
104
104
- it ( 'isFunction' , async ( ) => {
105
+ it ( 'isFunction() ' , async ( ) => {
105
106
expect ( isFunction ( 123 ) ) . toEqual ( false )
106
107
expect ( isFunction ( '123' ) ) . toEqual ( false )
107
108
expect ( isFunction ( true ) ) . toEqual ( false )
@@ -115,7 +116,7 @@ describe('utils/inspect', () => {
115
116
expect ( isFunction ( null ) ) . toEqual ( false )
116
117
} )
117
118
118
- it ( 'isBoolean' , async ( ) => {
119
+ it ( 'isBoolean() ' , async ( ) => {
119
120
expect ( isBoolean ( 123 ) ) . toEqual ( false )
120
121
expect ( isBoolean ( '123' ) ) . toEqual ( false )
121
122
expect ( isBoolean ( true ) ) . toEqual ( true )
@@ -129,7 +130,7 @@ describe('utils/inspect', () => {
129
130
expect ( isBoolean ( null ) ) . toEqual ( false )
130
131
} )
131
132
132
- it ( 'isString' , async ( ) => {
133
+ it ( 'isString() ' , async ( ) => {
133
134
expect ( isString ( 123 ) ) . toEqual ( false )
134
135
expect ( isString ( '123' ) ) . toEqual ( true )
135
136
expect ( isString ( true ) ) . toEqual ( false )
@@ -143,8 +144,9 @@ describe('utils/inspect', () => {
143
144
expect ( isString ( null ) ) . toEqual ( false )
144
145
} )
145
146
146
- it ( 'isNumber' , async ( ) => {
147
+ it ( 'isNumber() ' , async ( ) => {
147
148
expect ( isNumber ( 123 ) ) . toEqual ( true )
149
+ expect ( isNumber ( 123.5 ) ) . toEqual ( true )
148
150
expect ( isNumber ( '123' ) ) . toEqual ( false )
149
151
expect ( isNumber ( true ) ) . toEqual ( false )
150
152
expect ( isNumber ( { } ) ) . toEqual ( false )
@@ -157,7 +159,24 @@ describe('utils/inspect', () => {
157
159
expect ( isNumber ( null ) ) . toEqual ( false )
158
160
} )
159
161
160
- it ( 'isPrimitive' , async ( ) => {
162
+ it ( 'isNumeric()' , async ( ) => {
163
+ expect ( isNumeric ( 123 ) ) . toEqual ( true )
164
+ expect ( isNumeric ( 123.5 ) ) . toEqual ( true )
165
+ expect ( isNumeric ( '123' ) ) . toEqual ( true )
166
+ expect ( isNumeric ( '123.5' ) ) . toEqual ( true )
167
+ expect ( isNumeric ( '123,5' ) ) . toEqual ( false )
168
+ expect ( isNumeric ( true ) ) . toEqual ( false )
169
+ expect ( isNumeric ( { } ) ) . toEqual ( false )
170
+ expect ( isNumeric ( [ ] ) ) . toEqual ( false )
171
+ expect ( isNumeric ( / a b c / ) ) . toEqual ( false )
172
+ expect ( isNumeric ( ( ) => { } ) ) . toEqual ( false )
173
+ expect ( isNumeric ( Date ) ) . toEqual ( false )
174
+ expect ( isNumeric ( new Date ( ) ) ) . toEqual ( false )
175
+ expect ( isNumeric ( undefined ) ) . toEqual ( false )
176
+ expect ( isNumeric ( null ) ) . toEqual ( false )
177
+ } )
178
+
179
+ it ( 'isPrimitive()' , async ( ) => {
161
180
expect ( isPrimitive ( 123 ) ) . toEqual ( true )
162
181
expect ( isPrimitive ( '123' ) ) . toEqual ( true )
163
182
expect ( isPrimitive ( true ) ) . toEqual ( true )
@@ -171,7 +190,7 @@ describe('utils/inspect', () => {
171
190
expect ( isPrimitive ( null ) ) . toEqual ( false )
172
191
} )
173
192
174
- it ( 'isDate' , async ( ) => {
193
+ it ( 'isDate() ' , async ( ) => {
175
194
expect ( isDate ( 123 ) ) . toEqual ( false )
176
195
expect ( isDate ( '123' ) ) . toEqual ( false )
177
196
expect ( isDate ( true ) ) . toEqual ( false )
@@ -185,7 +204,7 @@ describe('utils/inspect', () => {
185
204
expect ( isDate ( null ) ) . toEqual ( false )
186
205
} )
187
206
188
- it ( 'isEvent' , async ( ) => {
207
+ it ( 'isEvent() ' , async ( ) => {
189
208
expect ( isEvent ( 123 ) ) . toEqual ( false )
190
209
expect ( isEvent ( '123' ) ) . toEqual ( false )
191
210
expect ( isEvent ( true ) ) . toEqual ( false )
@@ -201,7 +220,7 @@ describe('utils/inspect', () => {
201
220
expect ( isEvent ( null ) ) . toEqual ( false )
202
221
} )
203
222
204
- it ( 'isRegExp' , async ( ) => {
223
+ it ( 'isRegExp() ' , async ( ) => {
205
224
expect ( isRegExp ( 123 ) ) . toEqual ( false )
206
225
expect ( isRegExp ( '123' ) ) . toEqual ( false )
207
226
expect ( isRegExp ( true ) ) . toEqual ( false )
@@ -215,7 +234,7 @@ describe('utils/inspect', () => {
215
234
expect ( isRegExp ( null ) ) . toEqual ( false )
216
235
} )
217
236
218
- it ( 'isPromise' , async ( ) => {
237
+ it ( 'isPromise() ' , async ( ) => {
219
238
expect ( isPromise ( 123 ) ) . toEqual ( false )
220
239
expect ( isPromise ( '123' ) ) . toEqual ( false )
221
240
expect ( isPromise ( true ) ) . toEqual ( false )
0 commit comments