-
Notifications
You must be signed in to change notification settings - Fork 255
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a unit test for multiple payloads. Generates types
- Loading branch information
Showing
3 changed files
with
74 additions
and
5 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 |
---|---|---|
|
@@ -71,6 +71,76 @@ describe('Facebook Custom Audiences', () => { | |
]) | ||
}) | ||
|
||
it('should generate data correctly for multiple users', async () => {}) | ||
it('should generate data correctly for multiple users', async () => { | ||
const payloads: Payload[] = new Array(2) | ||
|
||
payloads[0] = { | ||
email: '[email protected]', | ||
phone: '555-555-5555', | ||
name: { | ||
first: 'Henry', | ||
last: 'Aaron' | ||
}, | ||
externalId: '5' | ||
} | ||
|
||
payloads[1] = { | ||
email: '[email protected]', | ||
gender: 'male', | ||
birth: { | ||
year: '1960', | ||
month: 'May', | ||
day: '9' | ||
}, | ||
name: { | ||
first: 'Tony', | ||
last: 'Gwynn', | ||
firstInitial: 'T' | ||
}, | ||
address: { | ||
city: 'San Diego', | ||
state: 'CA', | ||
zip: '92000', | ||
country: 'US' | ||
} | ||
} | ||
|
||
expect(generateData(payloads)).toEqual([ | ||
[ | ||
hash(payloads[0].externalId || ''), // external_id | ||
hash(payloads[0].email || ''), // email | ||
hash(payloads[0].phone || ''), // phone | ||
EMPTY, // gender | ||
EMPTY, // year | ||
EMPTY, // month | ||
EMPTY, // day | ||
hash(payloads[0].name?.last || ''), // last_name | ||
hash(payloads[0].name?.first || ''), // first_name | ||
EMPTY, // first_initial | ||
EMPTY, // city | ||
EMPTY, // state | ||
EMPTY, // zip | ||
EMPTY, // mobile_advertiser_id, | ||
EMPTY // country | ||
], | ||
[ | ||
EMPTY, // external_id | ||
hash(payloads[1].email || ''), // email | ||
EMPTY, // phone | ||
hash(payloads[1].gender || ''), // gender | ||
hash(payloads[1].birth?.year || ''), // year | ||
hash(payloads[1].birth?.month || ''), // month | ||
hash(payloads[1].birth?.day || ''), // day | ||
hash(payloads[1].name?.last || ''), // last_name | ||
hash(payloads[1].name?.first || ''), // first_name | ||
hash(payloads[1].name?.firstInitial || ''), // first_initial | ||
hash(payloads[1].address?.city || ''), // city | ||
hash(payloads[1].address?.state || ''), // state | ||
hash(payloads[1].address?.zip || ''), // zip | ||
EMPTY, // mobile_advertiser_id, | ||
hash(payloads[1].address?.country || '') // country | ||
] | ||
]) | ||
}) | ||
}) | ||
}) |
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
6 changes: 3 additions & 3 deletions
6
...es/destination-actions/src/destinations/facebook-custom-audiences/sync/generated-types.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.