@@ -171,42 +171,56 @@ describe('Options props', () => {
171
171
makeInstance ( 'hello' , String )
172
172
expect ( console . error . calls . count ( ) ) . toBe ( 0 )
173
173
makeInstance ( 123 , String )
174
- expect ( 'Expected String' ) . toHaveBeenWarned ( )
174
+ expect ( 'Expected String with value "123", got Number with value 123 ' ) . toHaveBeenWarned ( )
175
175
} )
176
176
177
177
it ( 'number' , ( ) => {
178
178
makeInstance ( 123 , Number )
179
179
expect ( console . error . calls . count ( ) ) . toBe ( 0 )
180
180
makeInstance ( '123' , Number )
181
- expect ( 'Expected Number' ) . toHaveBeenWarned ( )
181
+ expect ( 'Expected Number with value 123, got String with value "123"' ) . toHaveBeenWarned ( )
182
+ } )
183
+
184
+ it ( 'number & boolean' , ( ) => {
185
+ makeInstance ( 123 , Number )
186
+ expect ( console . error . calls . count ( ) ) . toBe ( 0 )
187
+ makeInstance ( false , Number )
188
+ expect ( 'Expected Number, got Boolean with value false' ) . toHaveBeenWarned ( )
189
+ } )
190
+
191
+ it ( 'string & boolean' , ( ) => {
192
+ makeInstance ( 'hello' , String )
193
+ expect ( console . error . calls . count ( ) ) . toBe ( 0 )
194
+ makeInstance ( true , String )
195
+ expect ( 'Expected String, got Boolean with value true' ) . toHaveBeenWarned ( )
182
196
} )
183
197
184
198
it ( 'boolean' , ( ) => {
185
199
makeInstance ( true , Boolean )
186
200
expect ( console . error . calls . count ( ) ) . toBe ( 0 )
187
201
makeInstance ( '123' , Boolean )
188
- expect ( 'Expected Boolean' ) . toHaveBeenWarned ( )
202
+ expect ( 'Expected Boolean, got String with value "123" ' ) . toHaveBeenWarned ( )
189
203
} )
190
204
191
205
it ( 'function' , ( ) => {
192
206
makeInstance ( ( ) => { } , Function )
193
207
expect ( console . error . calls . count ( ) ) . toBe ( 0 )
194
208
makeInstance ( 123 , Function )
195
- expect ( 'Expected Function' ) . toHaveBeenWarned ( )
209
+ expect ( 'Expected Function, got Number with value 123 ' ) . toHaveBeenWarned ( )
196
210
} )
197
211
198
212
it ( 'object' , ( ) => {
199
213
makeInstance ( { } , Object )
200
214
expect ( console . error . calls . count ( ) ) . toBe ( 0 )
201
215
makeInstance ( [ ] , Object )
202
- expect ( 'Expected Object' ) . toHaveBeenWarned ( )
216
+ expect ( 'Expected Object, got Array ' ) . toHaveBeenWarned ( )
203
217
} )
204
218
205
219
it ( 'array' , ( ) => {
206
220
makeInstance ( [ ] , Array )
207
221
expect ( console . error . calls . count ( ) ) . toBe ( 0 )
208
222
makeInstance ( { } , Array )
209
- expect ( 'Expected Array' ) . toHaveBeenWarned ( )
223
+ expect ( 'Expected Array, got Object ' ) . toHaveBeenWarned ( )
210
224
} )
211
225
212
226
it ( 'primitive wrapper objects' , ( ) => {
@@ -225,7 +239,7 @@ describe('Options props', () => {
225
239
makeInstance ( Symbol ( 'foo' ) , Symbol )
226
240
expect ( console . error . calls . count ( ) ) . toBe ( 0 )
227
241
makeInstance ( { } , Symbol )
228
- expect ( 'Expected Symbol' ) . toHaveBeenWarned ( )
242
+ expect ( 'Expected Symbol, got Object ' ) . toHaveBeenWarned ( )
229
243
} )
230
244
}
231
245
@@ -257,7 +271,7 @@ describe('Options props', () => {
257
271
makeInstance ( 123 , Number , v => v === 234 )
258
272
expect ( 'custom validator check failed' ) . toHaveBeenWarned ( )
259
273
makeInstance ( 123 , String , v => v === 123 )
260
- expect ( 'Expected String' ) . toHaveBeenWarned ( )
274
+ expect ( 'Expected String with value "123", got Number with value 123 ' ) . toHaveBeenWarned ( )
261
275
} )
262
276
263
277
it ( 'multiple types + custom validator' , ( ) => {
0 commit comments