Skip to content

Commit 2b3705f

Browse files
authored
fix: resolving comments (#10)
1 parent eb4c130 commit 2b3705f

4 files changed

Lines changed: 8 additions & 9 deletions

File tree

packages/destination-actions/src/destinations/moengage/__tests__/__snapshots__/snapshot.test.ts.snap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ Object {
7070
"os": Object {},
7171
},
7272
"event": "E@t!q#n(^u",
73-
"properties": Object {},
7473
"type": "E@t!q#n(^u",
7574
"update_existing_only": false,
7675
}

packages/destination-actions/src/destinations/moengage/trackEvent/__tests__/__snapshots__/snapshot.test.ts.snap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ Object {
3434
"os": Object {},
3535
},
3636
"event": "[3(wtAyZqr",
37-
"properties": Object {},
3837
"type": "[3(wtAyZqr",
3938
"update_existing_only": false,
4039
}

packages/destination-actions/src/destinations/moengage/trackEvent/__tests__/index.test.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ describe('ActionsMoengage.trackEvent', () => {
125125

126126
nock(`${endpoint}`).post(`/v1/integrations/segment?appId=${api_id}`).reply(200, {})
127127

128-
try {
129-
await testDestination.testAction('trackEvent', {
128+
await expect(
129+
testDestination.testAction('trackEvent', {
130130
event,
131131
useDefaultMappings: true,
132132
settings: {
@@ -135,8 +135,6 @@ describe('ActionsMoengage.trackEvent', () => {
135135
region
136136
}
137137
})
138-
} catch (e) {
139-
expect(e.message).toBe("The root value is missing the required field 'event'.")
140-
}
138+
).rejects.toThrow("The root value is missing the required field 'event'.")
141139
})
142140
})

packages/destination-actions/src/destinations/moengage/trackEvent/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,12 @@ const action: ActionDefinition<Settings, Payload> = {
106106
throw new IntegrationError('Missing API ID or API KEY', 'Missing required field', 400)
107107
}
108108

109-
const properties = payload.properties ? { ...payload.properties } : {}
109+
let properties = payload.properties
110110
if (payload.project_name) {
111-
properties.moe_project_name = payload.project_name
111+
properties = {
112+
...(payload.properties ?? {}),
113+
moe_project_name: payload.project_name
114+
}
112115
}
113116

114117
const event = {

0 commit comments

Comments
 (0)