Repository URL to install this package:
|
Version:
1.0.0-alpha.7 ▾
|
import { getTrackingDataAttributes } from './getTrackingDataAttributes';
describe('getTrackingDataAttributes', () => {
it('returns an object with all the tracking attributes mapped from a DOM element', () => {
const trackingData = {
track: { event: 'clicked it' },
page: { name: 'homepage' },
identify: { userId: '123456' },
};
expect(getTrackingDataAttributes(trackingData)).toEqual({
'data-identify': '{"userId":"123456"}',
'data-page': '{"name":"homepage"}',
'data-track': '{"event":"clicked it"}',
});
});
});