-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update utils to generate simplified payloads for tests
- Loading branch information
Showing
5 changed files
with
300 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,21 +32,24 @@ export const groupTestData = [ | |
body: [ | ||
{ | ||
destination, | ||
message: generateGroupPayload({ | ||
userId: 'user123', | ||
groupId: 'XUepkK', | ||
traits: { | ||
subscribe: true, | ||
}, | ||
context: { | ||
message: generateGroupPayload( | ||
{ | ||
userId: 'user123', | ||
groupId: 'XUepkK', | ||
traits: { | ||
email: '[email protected]', | ||
phone: '+12 345 678 900', | ||
consent: ['email'], | ||
subscribe: true, | ||
}, | ||
context: { | ||
traits: { | ||
email: '[email protected]', | ||
phone: '+12 345 678 900', | ||
consent: ['email'], | ||
}, | ||
}, | ||
timestamp: '2020-01-21T00:21:34.208Z', | ||
}, | ||
timestamp: '2020-01-21T00:21:34.208Z', | ||
}), | ||
true, | ||
), | ||
}, | ||
], | ||
}, | ||
|
@@ -94,21 +97,24 @@ export const groupTestData = [ | |
body: [ | ||
{ | ||
destination, | ||
message: generateGroupPayload({ | ||
userId: 'user123', | ||
groupId: '', | ||
traits: { | ||
subscribe: true, | ||
}, | ||
context: { | ||
message: generateGroupPayload( | ||
{ | ||
userId: 'user123', | ||
groupId: '', | ||
traits: { | ||
email: '[email protected]', | ||
phone: '+12 345 678 900', | ||
consent: 'email', | ||
subscribe: true, | ||
}, | ||
context: { | ||
traits: { | ||
email: '[email protected]', | ||
phone: '+12 345 678 900', | ||
consent: 'email', | ||
}, | ||
}, | ||
timestamp: '2020-01-21T00:21:34.208Z', | ||
}, | ||
timestamp: '2020-01-21T00:21:34.208Z', | ||
}), | ||
true, | ||
), | ||
}, | ||
], | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,14 +100,17 @@ export const identifyData = [ | |
body: [ | ||
{ | ||
destination, | ||
message: generateIndentifyPayload({ | ||
context: { | ||
traits: commonTraits, | ||
message: generateIndentifyPayload( | ||
{ | ||
context: { | ||
traits: commonTraits, | ||
}, | ||
anonymousId, | ||
userId, | ||
sentAt, | ||
}, | ||
anonymousId, | ||
userId, | ||
sentAt, | ||
}), | ||
true, | ||
), | ||
}, | ||
], | ||
}, | ||
|
@@ -166,24 +169,27 @@ export const identifyData = [ | |
body: [ | ||
{ | ||
destination: overrideDestination(destination, { flattenProperties: true }), | ||
message: generateIndentifyPayload({ | ||
sentAt, | ||
userId, | ||
context: { | ||
traits: { | ||
...commonTraits, | ||
friend: { | ||
names: { | ||
first: 'Alice', | ||
last: 'Smith', | ||
message: generateIndentifyPayload( | ||
{ | ||
sentAt, | ||
userId, | ||
context: { | ||
traits: { | ||
...commonTraits, | ||
friend: { | ||
names: { | ||
first: 'Alice', | ||
last: 'Smith', | ||
}, | ||
age: 25, | ||
}, | ||
age: 25, | ||
}, | ||
}, | ||
anonymousId, | ||
originalTimestamp, | ||
}, | ||
anonymousId, | ||
originalTimestamp, | ||
}), | ||
true, | ||
), | ||
}, | ||
], | ||
}, | ||
|
@@ -255,18 +261,21 @@ export const identifyData = [ | |
privateApiKey: 'dummyPrivateApiKeyforfailure', | ||
}, | ||
}, | ||
message: generateIndentifyPayload({ | ||
sentAt, | ||
userId, | ||
context: { | ||
traits: { | ||
...commonTraits, | ||
email: '[email protected]', | ||
message: generateIndentifyPayload( | ||
{ | ||
sentAt, | ||
userId, | ||
context: { | ||
traits: { | ||
...commonTraits, | ||
email: '[email protected]', | ||
}, | ||
}, | ||
anonymousId, | ||
originalTimestamp, | ||
}, | ||
anonymousId, | ||
originalTimestamp, | ||
}), | ||
true, | ||
), | ||
}, | ||
], | ||
}, | ||
|
@@ -307,18 +316,21 @@ export const identifyData = [ | |
body: [ | ||
{ | ||
destination, | ||
message: generateIndentifyPayload({ | ||
sentAt, | ||
userId, | ||
context: { | ||
traits: { | ||
...commonTraits, | ||
properties: { ...commonTraits.properties, subscribe: false }, | ||
message: generateIndentifyPayload( | ||
{ | ||
sentAt, | ||
userId, | ||
context: { | ||
traits: { | ||
...commonTraits, | ||
properties: { ...commonTraits.properties, subscribe: false }, | ||
}, | ||
}, | ||
anonymousId, | ||
originalTimestamp, | ||
}, | ||
anonymousId, | ||
originalTimestamp, | ||
}), | ||
true, | ||
), | ||
}, | ||
], | ||
}, | ||
|
@@ -362,15 +374,18 @@ export const identifyData = [ | |
body: [ | ||
{ | ||
destination: overrideDestination(destination, { enforceEmailAsPrimary: true }), | ||
message: generateIndentifyPayload({ | ||
sentAt, | ||
userId, | ||
context: { | ||
traits: commonTraits, | ||
message: generateIndentifyPayload( | ||
{ | ||
sentAt, | ||
userId, | ||
context: { | ||
traits: commonTraits, | ||
}, | ||
anonymousId, | ||
originalTimestamp, | ||
}, | ||
anonymousId, | ||
originalTimestamp, | ||
}), | ||
true, | ||
), | ||
}, | ||
], | ||
}, | ||
|
@@ -437,19 +452,22 @@ export const identifyData = [ | |
body: [ | ||
{ | ||
destination: destination, | ||
message: generateIndentifyPayload({ | ||
sentAt, | ||
userId, | ||
context: { | ||
traits: removeUndefinedAndNullValues({ | ||
...commonTraits, | ||
Flagged: undefined, | ||
Residence: undefined, | ||
}), | ||
message: generateIndentifyPayload( | ||
{ | ||
sentAt, | ||
userId, | ||
context: { | ||
traits: removeUndefinedAndNullValues({ | ||
...commonTraits, | ||
Flagged: undefined, | ||
Residence: undefined, | ||
}), | ||
}, | ||
anonymousId, | ||
originalTimestamp, | ||
}, | ||
anonymousId, | ||
originalTimestamp, | ||
}), | ||
true, | ||
), | ||
}, | ||
], | ||
}, | ||
|
@@ -511,19 +529,22 @@ export const identifyData = [ | |
body: [ | ||
{ | ||
destination: overrideDestination(destination, { enforceEmailAsPrimary: true }), | ||
message: generateIndentifyPayload({ | ||
sentAt, | ||
userId, | ||
context: { | ||
traits: removeUndefinedAndNullValues({ | ||
...commonTraits, | ||
email: undefined, | ||
phone: undefined, | ||
}), | ||
message: generateIndentifyPayload( | ||
{ | ||
sentAt, | ||
userId, | ||
context: { | ||
traits: removeUndefinedAndNullValues({ | ||
...commonTraits, | ||
email: undefined, | ||
phone: undefined, | ||
}), | ||
}, | ||
anonymousId, | ||
originalTimestamp, | ||
}, | ||
anonymousId, | ||
originalTimestamp, | ||
}), | ||
true, | ||
), | ||
}, | ||
], | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.