Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@doodle/tracking / src / helpers / setTrackingAttributes.spec.js
Size: Mime:
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"}',
    });
  });
});