Skip to content

Commit 8d224ab

Browse files
committed
wip
1 parent dd4b14d commit 8d224ab

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

packages/browser/src/core/arguments-resolver/__tests__/index.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,16 @@ describe(resolvePageArguments, () => {
415415
expect(options).toEqual(baseOptions)
416416
expect(cb).toEqual(fn)
417417
})
418+
419+
test('should accept (callback)', () => {
420+
const fn = jest.fn()
421+
const [category, name, properties, options, cb] = resolvePageArguments(fn)
422+
expect(category).toEqual(null)
423+
expect(name).toEqual(null)
424+
expect(properties).toEqual({})
425+
expect(options).toEqual({})
426+
expect(cb).toEqual(fn)
427+
})
418428
})
419429

420430
describe(resolveUserArguments, () => {

packages/browser/src/core/arguments-resolver/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,16 @@ export function resolvePageArguments(
9696
const resolvedCallback = args.find(isFunction) as Callback | undefined
9797

9898
// handle:
99+
// - analytics.page('name')
100+
// - analytics.page('category', 'name')
99101
// - analytics.page(properties)
100102
// - analytics.page(properties, options)
101103
// - analytics.page('name', properties)
102104
// - analytics.page('name', properties, options)
103105
// - analytics.page('category', 'name', properties, options)
106+
// - analytics.page('category', 'name', properties, options, callback)
107+
// - analytics.page('category', 'name', callback)
108+
// - analytics.page(callback), etc
104109
args.forEach((obj, argIdx) => {
105110
if (isPlainObject(obj)) {
106111
if (argIdx === 0) {

0 commit comments

Comments
 (0)