Skip to content

Commit 0cc05b4

Browse files
committed
fix: js error when duplicating requests with no args
1 parent edb2a4d commit 0cc05b4

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/MigrationManager.ts

+4
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ export default class MigrationManager {
9797
return false
9898
}
9999

100+
if (!args) {
101+
args = new ArgsBuilder()
102+
}
103+
100104
if (state === MigrationState.DUPLICATE) {
101105
args.add(Constants.PARAMS.CT, true)
102106
}

test/specs/MigrationManager.test.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ describe(MigrationManager, () => {
7777
})
7878
})
7979

80-
describe('modifyRequest', () => {
80+
describe('duplicateRequest', () => {
8181
it('adds ct parameter when duplicating requests', () => {
8282
setMigrationState(DUPLICATE)
8383

@@ -100,6 +100,14 @@ describe(MigrationManager, () => {
100100
expect(suppress).toBe(false)
101101
})
102102

103+
it('does not crash when request has no args', () => {
104+
setMigrationState(DUPLICATE)
105+
106+
const suppress = manager.duplicateRequest('getNewsfeedMessages', undefined, {})
107+
108+
expect(suppress).toBe(false)
109+
})
110+
103111
it('returns true if request should be suppressed', () => {
104112
setMigrationState(CLEVERTAP)
105113

0 commit comments

Comments
 (0)