33 resolvePageArguments ,
44 resolveUserArguments ,
55 resolveAliasArguments ,
6- } from '../'
6+ } from '../index '
77import { Callback } from '../../events'
88import { User } from '../../user'
99
@@ -219,6 +219,37 @@ describe(resolvePageArguments, () => {
219219 } ,
220220 } ,
221221 } )
222+ expect ( properties ) . toEqual ( { } )
223+ } )
224+
225+ it ( 'should accept (category, name)' , ( ) => {
226+ const [ category , name , properties , options , cb ] = resolvePageArguments (
227+ 'category' ,
228+ 'name'
229+ )
230+
231+ expect ( name ) . toEqual ( 'name' )
232+ expect ( category ) . toEqual ( 'category' )
233+ expect ( properties ) . toEqual ( { } )
234+ expect ( options ) . toEqual ( { } )
235+ expect ( cb ) . toEqual ( undefined )
236+ } )
237+
238+ it ( 'should accept (category, name, properties, options, cb)' , ( ) => {
239+ const fn = jest . fn ( )
240+ const [ category , name , properties , options , cb ] = resolvePageArguments (
241+ 'foo' ,
242+ 'name' ,
243+ bananaPhone ,
244+ baseOptions ,
245+ fn
246+ )
247+
248+ expect ( category ) . toEqual ( 'foo' )
249+ expect ( name ) . toEqual ( 'name' )
250+ expect ( properties ) . toEqual ( bananaPhone )
251+ expect ( options ) . toEqual ( baseOptions )
252+ expect ( cb ) . toEqual ( fn )
222253 } )
223254
224255 test ( 'should accept (category, name, properties, callback)' , ( ) => {
@@ -254,52 +285,48 @@ describe(resolvePageArguments, () => {
254285 expect ( options ) . toEqual ( { } )
255286 } )
256287
257- it ( 'should accept (name, properties, options, callback)' , ( ) => {
258- const fn = jest . fn ( )
288+ it ( 'should accept (name, properties)' , ( ) => {
259289 const [ category , name , properties , options , cb ] = resolvePageArguments (
260290 'name' ,
261- bananaPhone ,
262- baseOptions ,
263- fn
291+ bananaPhone
264292 )
265293
266- expect ( category ) . toEqual ( null )
267294 expect ( name ) . toEqual ( 'name' )
295+ expect ( category ) . toEqual ( null )
268296 expect ( properties ) . toEqual ( bananaPhone )
269- expect ( options ) . toEqual ( baseOptions )
270- expect ( cb ) . toEqual ( fn )
297+ expect ( options ) . toEqual ( { } )
298+ expect ( cb ) . toEqual ( undefined )
271299 } )
272300
273- it ( 'should accept (name, properties, callback)' , ( ) => {
301+ it ( 'should accept (name, properties, options, callback)' , ( ) => {
274302 const fn = jest . fn ( )
275303 const [ category , name , properties , options , cb ] = resolvePageArguments (
276304 'name' ,
277305 bananaPhone ,
306+ baseOptions ,
278307 fn
279308 )
280309
281310 expect ( category ) . toEqual ( null )
282311 expect ( name ) . toEqual ( 'name' )
283312 expect ( properties ) . toEqual ( bananaPhone )
313+ expect ( options ) . toEqual ( baseOptions )
284314 expect ( cb ) . toEqual ( fn )
285- expect ( options ) . toEqual ( { } )
286315 } )
287316
288- it ( 'should accept (category, name, properties, options, cb )' , ( ) => {
317+ it ( 'should accept (name, properties, callback )' , ( ) => {
289318 const fn = jest . fn ( )
290319 const [ category , name , properties , options , cb ] = resolvePageArguments (
291- 'foo' ,
292320 'name' ,
293321 bananaPhone ,
294- baseOptions ,
295322 fn
296323 )
297324
298- expect ( category ) . toEqual ( 'foo' )
325+ expect ( category ) . toEqual ( null )
299326 expect ( name ) . toEqual ( 'name' )
300327 expect ( properties ) . toEqual ( bananaPhone )
301- expect ( options ) . toEqual ( baseOptions )
302328 expect ( cb ) . toEqual ( fn )
329+ expect ( options ) . toEqual ( { } )
303330 } )
304331
305332 it ( 'should accept (name, callback)' , ( ) => {
@@ -348,7 +375,7 @@ describe(resolvePageArguments, () => {
348375 expect ( category ) . toEqual ( null )
349376 } )
350377
351- test ( 'should accept (category = null, name, properties, options, callback)' , ( ) => {
378+ test ( 'should accept (null, name, properties, options, callback)' , ( ) => {
352379 const fn = jest . fn ( )
353380 const [ category , name , properties , options , cb ] = resolvePageArguments (
354381 null ,
@@ -365,6 +392,64 @@ describe(resolvePageArguments, () => {
365392 expect ( cb ) . toEqual ( fn )
366393 } )
367394
395+ test ( 'should accept (name, null, properties, options, callback)' , ( ) => {
396+ const fn = jest . fn ( )
397+ const [ category , name , properties , options , cb ] = resolvePageArguments (
398+ 'name' ,
399+ null ,
400+ bananaPhone ,
401+ baseOptions ,
402+ fn
403+ )
404+
405+ expect ( category ) . toEqual ( null )
406+ expect ( name ) . toEqual ( 'name' )
407+ expect ( properties ) . toEqual ( bananaPhone )
408+ expect ( options ) . toEqual ( baseOptions )
409+ expect ( cb ) . toEqual ( fn )
410+ } )
411+
412+ test ( 'should accept (name, null, properties)' , ( ) => {
413+ const [ category , name , properties , options ] = resolvePageArguments (
414+ 'name' ,
415+ null ,
416+ bananaPhone
417+ )
418+
419+ expect ( name ) . toEqual ( 'name' )
420+ expect ( category ) . toEqual ( null )
421+ expect ( properties ) . toEqual ( bananaPhone )
422+ expect ( options ) . toEqual ( { } )
423+ } )
424+
425+ test ( 'should accept (name, null, null, options)' , ( ) => {
426+ const [ category , name , properties , options ] = resolvePageArguments (
427+ 'name' ,
428+ null ,
429+ null ,
430+ baseOptions
431+ )
432+
433+ expect ( name ) . toEqual ( 'name' )
434+ expect ( category ) . toEqual ( null )
435+ expect ( properties ) . toEqual ( { } )
436+ expect ( options ) . toEqual ( baseOptions )
437+ } )
438+
439+ test ( 'should accept (null, null, properties)' , ( ) => {
440+ const [ category , name , properties , options , cb ] = resolvePageArguments (
441+ null ,
442+ null ,
443+ bananaPhone
444+ )
445+
446+ expect ( category ) . toEqual ( null )
447+ expect ( name ) . toEqual ( null )
448+ expect ( properties ) . toEqual ( bananaPhone )
449+ expect ( options ) . toEqual ( { } )
450+ expect ( cb ) . toEqual ( undefined )
451+ } )
452+
368453 test ( 'should accept (null, null, properties, options, callback)' , ( ) => {
369454 const fn = jest . fn ( )
370455 const [ category , name , properties , options , cb ] = resolvePageArguments (
@@ -425,6 +510,16 @@ describe(resolvePageArguments, () => {
425510 expect ( options ) . toEqual ( { } )
426511 expect ( cb ) . toEqual ( fn )
427512 } )
513+
514+ test ( 'should accept (null, null, null, null, callback)' , ( ) => {
515+ const fn = jest . fn ( )
516+ const [ category , name , properties , options , cb ] = resolvePageArguments ( fn )
517+ expect ( category ) . toEqual ( null )
518+ expect ( name ) . toEqual ( null )
519+ expect ( properties ) . toEqual ( { } )
520+ expect ( options ) . toEqual ( { } )
521+ expect ( cb ) . toEqual ( fn )
522+ } )
428523} )
429524
430525describe ( resolveUserArguments , ( ) => {
0 commit comments