@aller/blink
Version:
A library for tracking user behaviour.
42 lines (38 loc) • 1.1 kB
text/typescript
import prepareBoxEvent from '../prepare-box-event';
import { VERSION } from '../../config/config';
import { BlinkEvent } from '../../types';
import { Page } from '../../selectors/get-page-state';
describe('prepareBoxEvent', () => {
it('should format properly based on state', () => {
const id = 'cool-box-id';
const title = 'A world class box title';
const height = 400;
const width = 600;
const page: Page = {
id: 'default',
state: {
general: {
pageView: 'some-pageview-uuid',
site: 'www.dagbladet.no',
referrer: 'www.dinside.no',
},
screen: { events: [] },
},
};
const expectedEvent: BlinkEvent = {
type: 'box',
pageView: 'some-pageview-uuid',
site: 'www.dagbladet.no',
referrer: 'www.dinside.no',
version: VERSION,
id: 'cool-box-id',
boxId: 'cool-box-id',
title: 'A world class box title',
height: 400,
width: 600,
};
expect(prepareBoxEvent({ page, id, title, height, width })).toEqual(
expectedEvent,
);
});
});