33 resolvePageArguments ,
44 resolveUserArguments ,
55 resolveAliasArguments ,
6- } from '../'
6+ } from '../index '
77import { Callback } from '../../events'
88import { User } from '../../user'
99
@@ -194,8 +194,8 @@ describe(resolveArguments, () => {
194194 } )
195195} )
196196
197- describe ( ' resolvePageArguments - analytics.page([category], [name], [properties], [options], [callback])' , ( ) => {
198- test ( 'empty strings ("", "", null , { integrations })' , ( ) => {
197+ describe ( resolvePageArguments , ( ) => {
198+ test ( 'empty strings ("", "", {} , { integrations })' , ( ) => {
199199 const [ category , name , properties , options ] = resolvePageArguments (
200200 '' ,
201201 '' ,
@@ -211,14 +211,14 @@ describe('resolvePageArguments - analytics.page([category], [name], [properties]
211211
212212 expect ( category ) . toEqual ( '' )
213213 expect ( name ) . toEqual ( '' )
214- expect ( properties ) . toEqual ( { } )
215214 expect ( options ) . toEqual ( {
216215 integrations : {
217216 Amplitude : {
218217 sessionId : '123' ,
219218 } ,
220219 } ,
221220 } )
221+ expect ( properties ) . toEqual ( { } )
222222 } )
223223
224224 it ( 'should accept (category, name)' , ( ) => {
@@ -391,38 +391,48 @@ describe('resolvePageArguments - analytics.page([category], [name], [properties]
391391 expect ( cb ) . toEqual ( fn )
392392 } )
393393
394- test ( 'should accept (category , null, properties, options, callback)' , ( ) => {
394+ test ( 'should accept (name , null, properties, options, callback)' , ( ) => {
395395 const fn = jest . fn ( )
396396 const [ category , name , properties , options , cb ] = resolvePageArguments (
397- 'category ' ,
397+ 'name ' ,
398398 null ,
399399 bananaPhone ,
400400 baseOptions ,
401401 fn
402402 )
403403
404- expect ( category ) . toEqual ( 'category' )
405- expect ( name ) . toEqual ( null )
404+ expect ( category ) . toEqual ( null )
405+ expect ( name ) . toEqual ( 'name' )
406406 expect ( properties ) . toEqual ( bananaPhone )
407407 expect ( options ) . toEqual ( baseOptions )
408408 expect ( cb ) . toEqual ( fn )
409409 } )
410410
411- test ( 'should accept (category, undefined, properties, options, callback)' , ( ) => {
412- const fn = jest . fn ( )
413- const [ category , name , properties , options , cb ] = resolvePageArguments (
414- 'category' ,
415- undefined ,
416- bananaPhone ,
417- baseOptions ,
418- fn
411+ test ( 'should accept (name, null, properties)' , ( ) => {
412+ const [ category , name , properties , options ] = resolvePageArguments (
413+ 'name' ,
414+ null ,
415+ bananaPhone
419416 )
420417
421- expect ( category ) . toEqual ( 'category ' )
422- expect ( name ) . toEqual ( undefined )
418+ expect ( name ) . toEqual ( 'name ' )
419+ expect ( category ) . toEqual ( null )
423420 expect ( properties ) . toEqual ( bananaPhone )
421+ expect ( options ) . toEqual ( { } )
422+ } )
423+
424+ test ( 'should accept (name, null, null, options)' , ( ) => {
425+ const [ category , name , properties , options ] = resolvePageArguments (
426+ 'name' ,
427+ null ,
428+ null ,
429+ baseOptions
430+ )
431+
432+ expect ( name ) . toEqual ( 'name' )
433+ expect ( category ) . toEqual ( null )
434+ expect ( properties ) . toEqual ( { } )
424435 expect ( options ) . toEqual ( baseOptions )
425- expect ( cb ) . toEqual ( fn )
426436 } )
427437
428438 test ( 'should accept (null, null, properties)' , ( ) => {
0 commit comments