Skip to content

Commit

Permalink
fix: user order (#3944)
Browse files Browse the repository at this point in the history
* fix: anonymousId overwriting userId at MoEngage destination (#3914)

fix/moengage-anonymousid-over-userid

Co-authored-by: Sudip Paul <67197965+ItsSudip@users.noreply.github.com>

* chore: fix test cases

---------

Co-authored-by: Landi <98327875+jmlandi@users.noreply.github.com>
  • Loading branch information
ItsSudip and jmlandi authored Dec 26, 2024
1 parent 227419f commit 43abf9c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/v0/destinations/moengage/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function responseBuilderSimple(message, category, destination) {
// using base64 and prepends it with the string 'Basic '.
Authorization: `Basic ${btoa(`${apiId}:${apiKey}`)}`,
};
response.userId = message.anonymousId || message.userId;
response.userId = message.userId || message.anonymousId;
if (payload) {
switch (category.type) {
case 'identify':
Expand Down
24 changes: 12 additions & 12 deletions test/integrations/destinations/moengage/processor/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ export const data = [
FORM: {},
},
files: {},
userId: '4eb021e9-a2af-4926-ae82-fe996d12f3c5',
userId: 'rudder123',
},
statusCode: 200,
},
Expand Down Expand Up @@ -418,7 +418,7 @@ export const data = [
files: {},
method: 'POST',
params: {},
userId: '4eb021e9-a2af-4926-ae82-fe996d12f3c5',
userId: 'rudder123',
headers: {
'MOE-APPKEY': 'W0ZHNMPI2O4KHJ48ZILZACRA',
'Content-Type': 'application/json',
Expand Down Expand Up @@ -686,7 +686,7 @@ export const data = [
files: {},
method: 'POST',
params: {},
userId: '4eb021e9-a2af-4926-ae82-fe996d12f3c5',
userId: 'rudder123',
headers: {
'MOE-APPKEY': 'W0ZHNMPI2O4KHJ48ZILZACRA',
'Content-Type': 'application/json',
Expand Down Expand Up @@ -719,7 +719,7 @@ export const data = [
files: {},
method: 'POST',
params: {},
userId: '4eb021e9-a2af-4926-ae82-fe996d12f3c5',
userId: 'rudder123',
headers: {
'MOE-APPKEY': 'W0ZHNMPI2O4KHJ48ZILZACRA',
'Content-Type': 'application/json',
Expand Down Expand Up @@ -851,7 +851,7 @@ export const data = [
files: {},
method: 'POST',
params: {},
userId: '4eb021e9-a2af-4926-ae82-fe996d12f3c5',
userId: 'rudder123',
headers: {
'MOE-APPKEY': 'W0ZHNMPI2O4KHJ48ZILZACRA',
'Content-Type': 'application/json',
Expand Down Expand Up @@ -983,7 +983,7 @@ export const data = [
files: {},
method: 'POST',
params: {},
userId: '4eb021e9-a2af-4926-ae82-fe996d12f3c5',
userId: 'rudder123',
headers: {
'MOE-APPKEY': 'W0ZHNMPI2O4KHJ48ZILZACRA',
'Content-Type': 'application/json',
Expand Down Expand Up @@ -1875,7 +1875,7 @@ export const data = [
FORM: {},
},
files: {},
userId: '4eb021e9-a2af-4926-ae82-fe996d12f3c5',
userId: 'rudder123',
},
statusCode: 200,
},
Expand Down Expand Up @@ -2008,7 +2008,7 @@ export const data = [
files: {},
method: 'POST',
params: {},
userId: '4eb021e9-a2af-4926-ae82-fe996d12f3c5',
userId: 'rudder123',
headers: {
'MOE-APPKEY': 'W0ZHNMPI2O4KHJ48ZILZACRA',
'Content-Type': 'application/json',
Expand Down Expand Up @@ -2041,7 +2041,7 @@ export const data = [
files: {},
method: 'POST',
params: {},
userId: '4eb021e9-a2af-4926-ae82-fe996d12f3c5',
userId: 'rudder123',
headers: {
'MOE-APPKEY': 'W0ZHNMPI2O4KHJ48ZILZACRA',
'Content-Type': 'application/json',
Expand Down Expand Up @@ -2318,7 +2318,7 @@ export const data = [
FORM: {},
},
files: {},
userId: '4eb021e9-a2af-4926-ae82-fe996d12f3c5',
userId: 'rudder123',
},
statusCode: 200,
},
Expand Down Expand Up @@ -2599,7 +2599,7 @@ export const data = [
FORM: {},
},
files: {},
userId: '4eb021e9-a2af-4926-ae82-fe996d12f3c5',
userId: 'rudder123',
},
statusCode: 200,
},
Expand Down Expand Up @@ -2875,7 +2875,7 @@ export const data = [
method: 'POST',
params: {},
type: 'REST',
userId: 'anon-dummyId-1',
userId: 'userId16',
version: '1',
},
statusCode: 200,
Expand Down
4 changes: 2 additions & 2 deletions test/integrations/destinations/moengage/router/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ export const data = [
FORM: {},
},
files: {},
userId: '4eb021e9-a2af-4926-ae82-fe996d12f3c5',
userId: 'rudder123',
},
metadata: [{ jobId: 1, userId: 'u1' }],
batched: false,
Expand Down Expand Up @@ -393,7 +393,7 @@ export const data = [
FORM: {},
},
files: {},
userId: '4eb021e9-a2af-4926-ae82-fe996d12f3c5',
userId: 'rudder123',
},
metadata: [{ jobId: 2, userId: 'u1' }],
batched: false,
Expand Down

0 comments on commit 43abf9c

Please sign in to comment.