-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8150881
commit c9248cb
Showing
2 changed files
with
48 additions
and
2 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 |
---|---|---|
|
@@ -143,6 +143,7 @@ describe('SnapPixel', () => { | |
email: '[email protected]', | ||
firstName: 'John', | ||
city: 'San Francisco', | ||
age: '16' | ||
}, | ||
}, | ||
}, | ||
|
@@ -153,6 +154,50 @@ describe('SnapPixel', () => { | |
snapPixel.identify(rudderElement); | ||
|
||
// Verify only provided parameters are included | ||
expect(window.snaptr.mock.calls[1]).toEqual([ | ||
'init', | ||
'12345', | ||
{ | ||
user_email: '[email protected]', | ||
firstname: 'John', | ||
geo_city: 'San Francisco', | ||
age: '16' | ||
}, | ||
]); | ||
}); | ||
|
||
it('should skip age if in object format', () => { | ||
const destinationConfig = { | ||
pixelId: '12345', | ||
deduplicationKey: 'email', | ||
hashMethod: false, | ||
enableDeduplication: false, | ||
eventMappingFromConfig: false, | ||
}; | ||
|
||
const analytics = { | ||
logLevel: 'debug', | ||
getAnonymousId: () => 'ANONYMOUS_ID', | ||
}; | ||
|
||
const rudderElement = { | ||
message: { | ||
context: { | ||
traits: { | ||
email: '[email protected]', | ||
firstName: 'John', | ||
city: 'San Francisco', | ||
age: { | ||
a: 1, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
const snapPixel = new SnapPixel(destinationConfig, analytics, destinationInfo); | ||
snapPixel.init(); | ||
snapPixel.identify(rudderElement); | ||
|
||
expect(window.snaptr.mock.calls[1]).toEqual([ | ||
'init', | ||
'12345', | ||
|
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