Repository URL to install this package:
|
Version:
0.6.0 ▾
|
import setTrackingAttributes from './setTrackingAttributes';
describe('setTrackingAttributes', () => {
it('should return an object with all the tracking attributes mapped from a DOM element', () => {
const valuesToTrack = {
ga: {
eventPage: 'Page',
eventAction: 'Action',
eventCategory: 'Category',
eventLabel: 'Label',
},
amplitude: {
eventType: 'Type',
eventName: 'Name',
eventProperties: {
'Some-Props': 'Prop',
},
},
};
expect(setTrackingAttributes(valuesToTrack)).toEqual({
'data-tracking': 'true',
// ga
'data-ga-page': 'Page',
'data-ga-action': 'Action',
'data-ga-category': 'Category',
'data-ga-label': 'Label',
// amplitude
'data-amplitude-type': 'Type',
'data-amplitude-name': 'Name',
'data-amplitude-properties': '{"Some-Props":"Prop"}',
});
});
});