@aller/blink
Version:
A library for tracking user behaviour.
62 lines (58 loc) • 1.55 kB
text/typescript
import prepareVideoLoadEvent, {
PrepareVideoLoadEventInput,
} from '../prepare-video-load-event';
import { VERSION } from '../../config/config';
import { BlinkEvent } from '../../types';
describe('prepareVideoLoadEvent', () => {
it('should format properly based on state', () => {
const input: PrepareVideoLoadEventInput = {
page: {
id: 'default',
state: {
general: {
pageView: 'some-pageview-uuid',
site: 'www.dagbladet.no',
referrer: 'www.dinside.no',
},
},
},
videoId: '123',
time: new Date(2),
duration: 25.4,
position: 11.2,
title: 'Test video title',
width: 720,
height: 480,
viewable: true,
muted: true,
quality: '720p',
withAdBlock: false,
canBeSticky: true,
streamingMode: 'live',
channelId: 'LaksIW2',
};
const expected: BlinkEvent = {
type: 'videoLoad',
pageView: 'some-pageview-uuid',
site: 'www.dagbladet.no',
referrer: 'www.dinside.no',
version: VERSION,
id: '123',
videoId: '123',
time: new Date(2),
title: 'Test video title',
width: 720,
height: 480,
videoPlayMuted: true,
videoPlayPosition: 11.2,
videoDuration: 25.4,
videoViewable: true,
videoQuality: '720p',
withAdBlock: false,
canBeSticky: true,
streamingMode: 'live',
channelId: 'LaksIW2',
};
expect(prepareVideoLoadEvent(input)).toEqual(expected);
});
});