Skip to content

Commit

Permalink
test: add start time unit tests (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
yairans authored Oct 19, 2021
1 parent b1ba289 commit 4777d8e
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions test/src/kava.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1181,6 +1181,57 @@ describe('KavaPlugin', function () {
player.addEventListener(player.Event.PLAYING, onPlaying);
player.play();
});

it('should send IMPRESSION event with the correct position - preload', done => {
sandbox.stub(OVPAnalyticsService, 'trackEvent').callsFake((serviceUrl, params) => {
if (params.eventType === KavaEventModel.IMPRESSION.index) {
try {
params.position.should.equal(20);
done();
} catch (e) {
done(e);
}
}
return new RequestBuilder();
});

setupPlayer({...config, playback: {preload: 'auto'}});
kava = getKavaPlugin();
});

it('should send IMPRESSION event with the correct position - autoplay', done => {
sandbox.stub(OVPAnalyticsService, 'trackEvent').callsFake((serviceUrl, params) => {
if (params.eventType === KavaEventModel.IMPRESSION.index) {
try {
params.position.should.equal(20);
done();
} catch (e) {
done(e);
}
}
return new RequestBuilder();
});

setupPlayer({...config, playback: {autoplay: true}});
kava = getKavaPlugin();
});

it('should send PLAY_REQUEST event with the correct position - autoplay', done => {
sandbox.stub(OVPAnalyticsService, 'trackEvent').callsFake((serviceUrl, params) => {
if (params.eventType === KavaEventModel.PLAY_REQUEST.index) {
try {
params.position.should.equal(20);
done();
} catch (e) {
done(e);
}
}
return new RequestBuilder();
});

setupPlayer({...config, playback: {autoplay: true}});
kava = getKavaPlugin();
});
});

describe('Server Response', () => {
Expand Down

0 comments on commit 4777d8e

Please sign in to comment.