From 22cbe7ccdf1d78b9b71e72e9b34b6b0d00d3e2f7 Mon Sep 17 00:00:00 2001 From: Pauline M <67742551+PaulineMDaily@users.noreply.github.com> Date: Wed, 14 Oct 2020 16:22:26 +0200 Subject: [PATCH 01/14] added a error method for all macros --- src/vast_tracker.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/vast_tracker.js b/src/vast_tracker.js index 0dcfdae9..1d934029 100644 --- a/src/vast_tracker.js +++ b/src/vast_tracker.js @@ -333,7 +333,9 @@ export class VASTTracker extends EventEmitter { { isCustomCode } ); } - + error(macros = {}) { + this.trackURLs(this.ad.errorURLTemplates, { macros }); + } /** * Must be called when the user watched the linear creative until its end. * Calls the complete tracking URLs. From 88277f238e4446c2d37f59cd9618ad673d0ace39 Mon Sep 17 00:00:00 2001 From: Pauline M <67742551+PaulineMDaily@users.noreply.github.com> Date: Wed, 14 Oct 2020 17:22:58 +0200 Subject: [PATCH 02/14] added unit testing for error method and updated errorWithCode method test --- test/vast_tracker.js | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/test/vast_tracker.js b/test/vast_tracker.js index df5c0969..52c97bff 100644 --- a/test/vast_tracker.js +++ b/test/vast_tracker.js @@ -285,11 +285,11 @@ describe('VASTTracker', function() { }); }); - describe('#errorWithCode', () => { + describe('#error', () => { before(() => { - util.track = function(URLTemplates, variables, options) { + util.track = function(URLTemplates, macros, options) { _eventsSent.push( - this.resolveURLTemplates(URLTemplates, variables, options) + this.resolveURLTemplates(URLTemplates, macros, options) ); }; }); @@ -297,6 +297,35 @@ describe('VASTTracker', function() { _eventsSent = []; }); + it('should have called error urls with right code', () => { + this.Tracker.error(405); + _eventsSent[0].should.eql([ + 'http://example.com/wrapperA-error', + 'http://example.com/wrapperB-error', + 'http://example.com/error_405' + ]); + }); + + it('should have called error urls with 900 if unknown code', () => { + this.Tracker.error(10001); + _eventsSent[0].should.eql([ + 'http://example.com/wrapperA-error', + 'http://example.com/wrapperB-error', + 'http://example.com/error_900' + ]); + }); + + describe('#errorWithCode', () => { + before(() => { + this.Tracker.error( + _eventsSent.push( + this.resolveURLTemplates(URLTemplates, macros, options) + ));; + }); + beforeEach(() => { + _eventsSent = []; + }); + it('should have called error urls with right code', () => { this.Tracker.errorWithCode(405); _eventsSent[0].should.eql([ From 8b14b9a5009c3baf6c8ece1ab6f593fbd5ce8627 Mon Sep 17 00:00:00 2001 From: Pauline M <67742551+PaulineMDaily@users.noreply.github.com> Date: Mon, 19 Oct 2020 18:13:41 +0200 Subject: [PATCH 03/14] Added unit tests and fixed comments on object sent to ErrorWithCode --- spec/vast_trackers.spec.js | 68 ++++++++++++++++++++++++++++++-------- src/vast_tracker.js | 42 +++++++++++++---------- 2 files changed, 79 insertions(+), 31 deletions(-) diff --git a/spec/vast_trackers.spec.js b/spec/vast_trackers.spec.js index bd536987..61c57cff 100644 --- a/spec/vast_trackers.spec.js +++ b/spec/vast_trackers.spec.js @@ -4,7 +4,7 @@ import { inlineTrackersParsed } from '../spec/samples/inline_trackers'; const vastClient = new VASTClient(); -describe('VASTTracker', function() { +describe('VASTTracker', function () { let vastTracker = null; describe('#linear', () => { @@ -13,13 +13,15 @@ describe('VASTTracker', function() { let spyTrack; let adTrackingUrls; let ad; + let isCustomCode = false; + let spyAdError; const expectedMacros = { ASSETURI: 'http%3A%2F%2Fexample.com%2Flinear-asset.mp4', UNIVERSALADID: 'sample-registry%20000123', PODSEQUENCE: '1', ADSERVINGID: 'z292x16y-3d7f-6440-bd29-2ec0f153fc89', ADTYPE: 'video', - ADCATEGORIES: 'Category-A%2CCategory-B%2CCategory-C' + ADCATEGORIES: 'Category-A%2CCategory-B%2CCategory-C', }; beforeEach(() => { ad = inlineTrackersParsed.ads[0]; @@ -28,6 +30,7 @@ describe('VASTTracker', function() { spyEmitter = jest.spyOn(vastTracker, 'emit'); spyTrackUrl = jest.spyOn(vastTracker, 'trackURLs'); spyTrack = jest.spyOn(vastTracker, 'track'); + spyAdError = jest.spyOn(vastTracker, 'error'); }); describe('#click', () => { @@ -45,7 +48,7 @@ describe('VASTTracker', function() { ad.creatives[0].videoClickTrackingURLTemplates, expect.objectContaining({ ...expectedMacros, - ADPLAYHEAD: '01%3A15%3A05.250' + ADPLAYHEAD: '01%3A15%3A05.250', }) ); }); @@ -60,7 +63,7 @@ describe('VASTTracker', function() { }); it('should have emitted minimize event and called trackUrl', () => { expect(spyEmitter).toHaveBeenCalledWith('minimize', { - trackingURLTemplates: adTrackingUrls.minimize + trackingURLTemplates: adTrackingUrls.minimize, }); expect(spyTrackUrl).toHaveBeenCalledWith( @@ -88,7 +91,7 @@ describe('VASTTracker', function() { expect.objectContaining(reasonMacro) ); expect(spyEmitter).toHaveBeenCalledWith('verificationNotExecuted', { - trackingURLTemplates: verificationUrl + trackingURLTemplates: verificationUrl, }); }); it('should throw missing AdVerification vendor error', () => { @@ -118,7 +121,7 @@ describe('VASTTracker', function() { }); it('should have emitted otherAdInteraction event and called trackUrl', () => { expect(spyEmitter).toHaveBeenCalledWith('otherAdInteraction', { - trackingURLTemplates: adTrackingUrls.otherAdInteraction + trackingURLTemplates: adTrackingUrls.otherAdInteraction, }); expect(spyTrackUrl).toHaveBeenCalledWith( adTrackingUrls.otherAdInteraction, @@ -136,7 +139,7 @@ describe('VASTTracker', function() { }); it('should have emitted acceptInvitation event and called trackUrl', () => { expect(spyEmitter).toHaveBeenCalledWith('acceptInvitation', { - trackingURLTemplates: adTrackingUrls.acceptInvitation + trackingURLTemplates: adTrackingUrls.acceptInvitation, }); expect(spyTrackUrl).toHaveBeenCalledWith( adTrackingUrls.acceptInvitation, @@ -154,7 +157,7 @@ describe('VASTTracker', function() { }); it('should have emitted adExpand event and called trackUrl', () => { expect(spyEmitter).toHaveBeenCalledWith('adExpand', { - trackingURLTemplates: adTrackingUrls.adExpand + trackingURLTemplates: adTrackingUrls.adExpand, }); expect(spyTrackUrl).toHaveBeenCalledWith( adTrackingUrls.adExpand, @@ -172,7 +175,7 @@ describe('VASTTracker', function() { }); it('should have emitted adCollapse event and called trackUrl', () => { expect(spyEmitter).toHaveBeenCalledWith('adCollapse', { - trackingURLTemplates: adTrackingUrls.adCollapse + trackingURLTemplates: adTrackingUrls.adCollapse, }); expect(spyTrackUrl).toHaveBeenCalledWith( adTrackingUrls.adCollapse, @@ -185,7 +188,7 @@ describe('VASTTracker', function() { beforeEach(() => { vastTracker.overlayViewDuration('00:00:30', { CONTENTPLAYHEAD: '00:00:40', - MEDIAPLAYHEAD: '00:00:40' + MEDIAPLAYHEAD: '00:00:40', }); }); it('should be defined', () => { @@ -193,7 +196,7 @@ describe('VASTTracker', function() { }); it('should have emitted adExpand event and called trackUrl', () => { expect(spyEmitter).toHaveBeenCalledWith('overlayViewDuration', { - trackingURLTemplates: adTrackingUrls.overlayViewDuration + trackingURLTemplates: adTrackingUrls.overlayViewDuration, }); expect(spyTrackUrl).toHaveBeenCalledWith( adTrackingUrls.overlayViewDuration, @@ -201,7 +204,7 @@ describe('VASTTracker', function() { ...expectedMacros, ADPLAYHEAD: '00%3A00%3A30', CONTENTPLAYHEAD: '00%3A00%3A40', - MEDIAPLAYHEAD: '00%3A00%3A40' + MEDIAPLAYHEAD: '00%3A00%3A40', }) ); }); @@ -216,7 +219,7 @@ describe('VASTTracker', function() { vastTracker.adCollapse(); expect(spyEmitter).toHaveBeenCalledWith('notUsed', { - trackingURLTemplates: adTrackingUrls.notUsed + trackingURLTemplates: adTrackingUrls.notUsed, }); expect(spyTrackUrl).toHaveBeenCalledWith( adTrackingUrls.notUsed, @@ -252,7 +255,7 @@ describe('VASTTracker', function() { describe('#trackImpression', () => { const macros = { - SERVERSIDE: '0' + SERVERSIDE: '0', }; beforeEach(() => { @@ -282,5 +285,42 @@ describe('VASTTracker', function() { expect(spyTrack).not.toHaveBeenCalledTimes(2); }); }); + describe('#error', () => { + let isCustomCode = false; + beforeEach(() => { + vastTracker.error(); + }); + it('should be defined', () => { + expect(ad.errorURLTemplates).toBeDefined(); + }); + it('should have emitted an ad Error and called trackUrl ', () => { + expect(spyTrackUrl).toHaveBeenCalledWith( + ['http://example.com/error_[ERRORCODE]'], + expect.objectContaining(expectedMacros), + expect.objectContaining({ isCustomCode }) + ); + expect(spyTrackUrl).toHaveBeenCalledTimes(1); + }); + }); + describe('#errorWithCode', () => { + let errorCode = 404; + beforeEach(() => { + vastTracker.errorWithCode(); + }); + it('should be defined', () => { + expect(ad.errorURLTemplates).toBeDefined(); + }); + it('should hava called the error method', () => { + expect(spyAdError).toHaveBeenCalledTimes(1); + }); + it('should have emitted adErrpr, called trackUrl and not emitted any other event', () => { + expect(spyTrackUrl).toHaveBeenCalledWith( + ['http://example.com/error_[ERRORCODE]'], + expect.objectContaining(expectedMacros), + expect.objectContaining({ isCustomCode }) + ); + expect(spyTrackUrl).toHaveBeenCalledTimes(1); + }); + }); }); }); diff --git a/src/vast_tracker.js b/src/vast_tracker.js index 1d934029..10a04ac0 100644 --- a/src/vast_tracker.js +++ b/src/vast_tracker.js @@ -55,7 +55,7 @@ export class VASTTracker extends EventEmitter { 'rewind', 'skip', 'closeLinear', - 'close' + 'close', ]; // Duplicate the creative's trackingEvents property so we can alter it @@ -148,7 +148,7 @@ export class VASTTracker extends EventEmitter { this.quartiles = { firstQuartile: Math.round(25 * this.assetDuration) / 100, midpoint: Math.round(50 * this.assetDuration) / 100, - thirdQuartile: Math.round(75 * this.assetDuration) / 100 + thirdQuartile: Math.round(75 * this.assetDuration) / 100, }; } @@ -198,7 +198,7 @@ export class VASTTracker extends EventEmitter { } this.lastPercentage = percent; } - events.forEach(eventName => { + events.forEach((eventName) => { this.track(eventName, { macros, once: true }); }); @@ -319,23 +319,31 @@ export class VASTTracker extends EventEmitter { } } + /** + * Send a request to the URI provided by the VAST element. + * @param {Object} [macros={}] - An optional Object containing macros and their values to be used and replaced in the tracking calls. + * + * @param {Boolean} [isCustomCode=false] - Flag to allow custom values on error code. + */ + + error(macros = {}, isCustomCode = false) { + this.trackURLs(this.ad.errorURLTemplates, macros, { isCustomCode }); + } + /** * Send a request to the URI provided by the VAST element. * If an [ERRORCODE] macro is included, it will be substitute with errorCode. + * This method is deprecated * * @param {String} errorCode - Replaces [ERRORCODE] macro. [ERRORCODE] values are listed in the VAST specification. * @param {Boolean} [isCustomCode=false] - Flag to allow custom values on error code. */ + errorWithCode(errorCode, isCustomCode = false) { - this.trackURLs( - this.ad.errorURLTemplates, - { ERRORCODE: errorCode }, - { isCustomCode } - ); - } - error(macros = {}) { - this.trackURLs(this.ad.errorURLTemplates, { macros }); + this.error({ ERRORCODE: errorCode }, isCustomCode); + console.log('errorWithCode : this method is deprecated'); } + /** * Must be called when the user watched the linear creative until its end. * Calls the complete tracking URLs. @@ -445,7 +453,7 @@ export class VASTTracker extends EventEmitter { } const vendorVerification = this.ad.adVerifications.find( - verifications => verifications.vendor === vendor + (verifications) => verifications.vendor === vendor ); if (!vendorVerification) { @@ -459,7 +467,7 @@ export class VASTTracker extends EventEmitter { const verifsNotExecuted = vendorTracking.verificationNotExecuted; this.trackURLs(verifsNotExecuted, macros); this.emit('verificationNotExecuted', { - trackingURLTemplates: verifsNotExecuted + trackingURLTemplates: verifsNotExecuted, }); } } @@ -618,9 +626,9 @@ export class VASTTracker extends EventEmitter { this.creative.universalAdId.idRegistry && this.creative.universalAdId.value ) { - macros['UNIVERSALADID'] = `${this.creative.universalAdId.idRegistry} ${ - this.creative.universalAdId.value - }`; + macros[ + 'UNIVERSALADID' + ] = `${this.creative.universalAdId.idRegistry} ${this.creative.universalAdId.value}`; } if (this.ad) { @@ -635,7 +643,7 @@ export class VASTTracker extends EventEmitter { } if (this.ad.categories && this.ad.categories.length) { macros['ADCATEGORIES'] = this.ad.categories - .map(categorie => categorie.value) + .map((categorie) => categorie.value) .join(','); } if (this.ad.blockedAdCategories && this.ad.blockedAdCategories.length) { From 3d69d0ecef9ac6f7c4c6430ef7bd71b1a133018c Mon Sep 17 00:00:00 2001 From: Pauline M <67742551+PaulineMDaily@users.noreply.github.com> Date: Tue, 20 Oct 2020 12:15:22 +0200 Subject: [PATCH 04/14] fixed an es-lint error about console.log --- test/vast_tracker.js | 119 ++++++++++++++++--------------------------- 1 file changed, 45 insertions(+), 74 deletions(-) diff --git a/test/vast_tracker.js b/test/vast_tracker.js index 52c97bff..3740b446 100644 --- a/test/vast_tracker.js +++ b/test/vast_tracker.js @@ -11,15 +11,15 @@ const now = new Date(); const vastParser = new VASTParser(); const vastClient = new VASTClient(); const options = { - urlhandler: nodeURLHandler + urlhandler: nodeURLHandler, }; -const urlfor = relpath => +const urlfor = (relpath) => `file:///${path .resolve(path.dirname(module.filename), 'vastfiles', relpath) .replace(/\\/g, '/')}`; -describe('VASTTracker', function() { +describe('VASTTracker', function () { before(() => { this.clock = sinon.useFakeTimers(now.getTime()); }); @@ -28,21 +28,21 @@ describe('VASTTracker', function() { this.clock.restore(); }); - describe('#constructor', function() { + describe('#constructor', function () { this.Tracker = null; let _eventsSent = []; this.templateFilterCalls = []; this.response = {}; - before(done => { - vastParser.addURLTemplateFilter(url => { + before((done) => { + vastParser.addURLTemplateFilter((url) => { this.templateFilterCalls.push(url); return url; }); vastParser .getAndParseVAST(urlfor('wrapper-a.xml'), options) - .then(response => { + .then((response) => { this.response = response; done(); }); @@ -57,11 +57,11 @@ describe('VASTTracker', function() { // Init tracker const ad = this.response.ads[0]; const creative = ad.creatives.filter( - creative => creative.id === 'id130984' + (creative) => creative.id === 'id130984' )[0]; this.Tracker = new VASTTracker(vastClient, ad, creative); // Mock emit - this.Tracker.emit = event => { + this.Tracker.emit = (event) => { _eventsSent.push(event); }; }); @@ -83,7 +83,7 @@ describe('VASTTracker', function() { }); describe('#setProgress', () => { - beforeEach(done => { + beforeEach((done) => { _eventsSent = []; done(); }); @@ -131,7 +131,7 @@ describe('VASTTracker', function() { }); describe('#setMuted', () => { - before(done => { + before((done) => { _eventsSent = []; this.Tracker.trackingEvents['mute'] = 'http://example.com/muted'; this.Tracker.trackingEvents['unmute'] = 'http://example.com/muted'; @@ -165,7 +165,7 @@ describe('VASTTracker', function() { }); describe('#setPaused', () => { - before(done => { + before((done) => { _eventsSent = []; this.Tracker.setPaused(true); done(); @@ -197,7 +197,7 @@ describe('VASTTracker', function() { }); describe('#setFullscreen', () => { - before(done => { + before((done) => { _eventsSent = []; this.Tracker.trackingEvents['fullscreen'] = 'http://example.com/fullscreen'; @@ -233,7 +233,7 @@ describe('VASTTracker', function() { }); describe('#setExpand', () => { - before(done => { + before((done) => { _eventsSent = []; this.Tracker.trackingEvents['expand'] = 'http://example.com/expand'; this.Tracker.trackingEvents[ @@ -285,42 +285,13 @@ describe('VASTTracker', function() { }); }); - describe('#error', () => { - before(() => { - util.track = function(URLTemplates, macros, options) { - _eventsSent.push( - this.resolveURLTemplates(URLTemplates, macros, options) - ); - }; - }); - beforeEach(() => { - _eventsSent = []; - }); - - it('should have called error urls with right code', () => { - this.Tracker.error(405); - _eventsSent[0].should.eql([ - 'http://example.com/wrapperA-error', - 'http://example.com/wrapperB-error', - 'http://example.com/error_405' - ]); - }); - - it('should have called error urls with 900 if unknown code', () => { - this.Tracker.error(10001); - _eventsSent[0].should.eql([ - 'http://example.com/wrapperA-error', - 'http://example.com/wrapperB-error', - 'http://example.com/error_900' - ]); - }); - describe('#errorWithCode', () => { before(() => { this.Tracker.error( _eventsSent.push( this.resolveURLTemplates(URLTemplates, macros, options) - ));; + ) + ); }); beforeEach(() => { _eventsSent = []; @@ -331,7 +302,7 @@ describe('VASTTracker', function() { _eventsSent[0].should.eql([ 'http://example.com/wrapperA-error', 'http://example.com/wrapperB-error', - 'http://example.com/error_405' + 'http://example.com/error_405', ]); }); @@ -340,7 +311,7 @@ describe('VASTTracker', function() { _eventsSent[0].should.eql([ 'http://example.com/wrapperA-error', 'http://example.com/wrapperB-error', - 'http://example.com/error_900' + 'http://example.com/error_900', ]); }); @@ -349,13 +320,13 @@ describe('VASTTracker', function() { _eventsSent[0].should.eql([ 'http://example.com/wrapperA-error', 'http://example.com/wrapperB-error', - 'http://example.com/error_10001' + 'http://example.com/error_10001', ]); }); }); describe('#complete', () => { - before(done => { + before((done) => { _eventsSent = []; this.Tracker.complete(); done(); @@ -367,8 +338,8 @@ describe('VASTTracker', function() { [ 'http://example.com/linear-complete', 'http://example.com/wrapperB-linear-complete', - 'http://example.com/wrapperA-linear-complete' - ] + 'http://example.com/wrapperA-linear-complete', + ], ]); }); @@ -380,14 +351,14 @@ describe('VASTTracker', function() { [ 'http://example.com/linear-complete', 'http://example.com/wrapperB-linear-complete', - 'http://example.com/wrapperA-linear-complete' - ] + 'http://example.com/wrapperA-linear-complete', + ], ]); }); }); describe('#close', () => { - before(done => { + before((done) => { _eventsSent = []; this.Tracker.close(); done(); @@ -396,26 +367,26 @@ describe('VASTTracker', function() { it('should have sent close event and urls VAST 2.0', () => { _eventsSent.should.eql([ 'close', - ['http://example.com/linear-close'] + ['http://example.com/linear-close'], ]); }); it('should have sent closeLinear event and urls VAST 3.0', () => { _eventsSent = []; this.Tracker.trackingEvents['closeLinear'] = [ - 'http://example.com/closelinear' + 'http://example.com/closelinear', ]; delete this.Tracker.trackingEvents['close']; this.Tracker.close(); _eventsSent.should.eql([ 'closeLinear', - ['http://example.com/closelinear'] + ['http://example.com/closelinear'], ]); }); }); describe('#skip', () => { - before(done => { + before((done) => { _eventsSent = []; this.Tracker.skip(); done(); @@ -436,9 +407,9 @@ describe('VASTTracker', function() { }); describe('#click', () => { - before(done => { + before((done) => { _eventsSent = []; - util.track = function(URLTemplates, variables) { + util.track = function (URLTemplates, variables) { _eventsSent.push(this.resolveURLTemplates(URLTemplates, variables)); }; this.Tracker.click(); @@ -455,7 +426,7 @@ describe('VASTTracker', function() { 'http://example.com/wrapperB-linear-clicktracking', 'http://example.com/wrapperA-linear-clicktracking1', 'http://example.com/wrapperA-linear-clicktracking2', - 'http://example.com/wrapperA-linear-clicktracking3' + 'http://example.com/wrapperA-linear-clicktracking3', ]); }); @@ -470,17 +441,17 @@ describe('VASTTracker', function() { // Init tracker const ad = this.response.ads[0]; const creative = ad.creatives.filter( - creative => creative.id === 'id130984' + (creative) => creative.id === 'id130984' )[0]; this.Tracker = new VASTTracker(vastClient, ad, creative); // Mock emit - this.Tracker.emit = event => { + this.Tracker.emit = (event) => { _eventsSent.push(event); }; }); describe('#setProgress seek ads IOS', () => { - beforeEach(done => { + beforeEach((done) => { _eventsSent = []; done(); }); @@ -500,7 +471,7 @@ describe('VASTTracker', function() { // Init tracker const ad = this.response.ads[0]; const creative = ad.creatives.filter( - creative => creative.id === 'id130985' + (creative) => creative.id === 'id130985' )[0]; const variation = creative.variations[0]; this.Tracker = new VASTTracker(vastClient, ad, creative, variation); @@ -511,9 +482,9 @@ describe('VASTTracker', function() { }); describe('#click', () => { - before(done => { + before((done) => { _eventsSent = []; - util.track = function(URLTemplates, variables) { + util.track = function (URLTemplates, variables) { _eventsSent.push(this.resolveURLTemplates(URLTemplates, variables)); }; this.Tracker.click(); @@ -528,14 +499,14 @@ describe('VASTTracker', function() { 'http://example.com/companion1-clicktracking-first', 'http://example.com/companion1-clicktracking-second', 'http://example.com/wrapperB-companion1-click-tracking', - 'http://example.com/wrapperA-companion1-click-tracking' + 'http://example.com/wrapperA-companion1-click-tracking', ]); }); it('should have sent clickthrough event with clickThrough url', () => { _eventsSent[1].event.should.eql('clickthrough'); _eventsSent[1].args.should.eql([ - 'http://example.com/companion1-clickthrough' + 'http://example.com/companion1-clickthrough', ]); }); }); @@ -546,7 +517,7 @@ describe('VASTTracker', function() { // Init tracker const ad = this.response.ads[0]; const creative = ad.creatives.filter( - creative => creative.id === 'id130986' + (creative) => creative.id === 'id130986' )[0]; const variation = creative.variations[0]; this.Tracker = new VASTTracker(vastClient, ad, creative, variation); @@ -561,9 +532,9 @@ describe('VASTTracker', function() { }); describe('#click', () => { - before(done => { + before((done) => { _eventsSent = []; - util.track = function(URLTemplates, variables) { + util.track = function (URLTemplates, variables) { _eventsSent.push(this.resolveURLTemplates(URLTemplates, variables)); }; this.Tracker.click(); @@ -576,14 +547,14 @@ describe('VASTTracker', function() { ); _eventsSent[0].should.eql([ 'http://example.com/nonlinear-clicktracking-1', - 'http://example.com/nonlinear-clicktracking-2' + 'http://example.com/nonlinear-clicktracking-2', ]); }); it('should have sent clickthrough event with clickThrough url', () => { _eventsSent[1].event.should.eql('clickthrough'); _eventsSent[1].args.should.eql([ - 'http://example.com/nonlinear-clickthrough' + 'http://example.com/nonlinear-clickthrough', ]); }); }); From f155182a1325efc2ec7e3faea5fab145d08a01cf Mon Sep 17 00:00:00 2001 From: Pauline M <67742551+PaulineMDaily@users.noreply.github.com> Date: Tue, 20 Oct 2020 12:55:24 +0200 Subject: [PATCH 05/14] updated tests and syntax --- spec/vast_trackers.spec.js | 3 +-- test/vast_tracker.js | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/spec/vast_trackers.spec.js b/spec/vast_trackers.spec.js index 61c57cff..53408233 100644 --- a/spec/vast_trackers.spec.js +++ b/spec/vast_trackers.spec.js @@ -303,7 +303,6 @@ describe('VASTTracker', function () { }); }); describe('#errorWithCode', () => { - let errorCode = 404; beforeEach(() => { vastTracker.errorWithCode(); }); @@ -313,7 +312,7 @@ describe('VASTTracker', function () { it('should hava called the error method', () => { expect(spyAdError).toHaveBeenCalledTimes(1); }); - it('should have emitted adErrpr, called trackUrl and not emitted any other event', () => { + it('should have emitted an ad error, called trackUrl and not emitted any other event', () => { expect(spyTrackUrl).toHaveBeenCalledWith( ['http://example.com/error_[ERRORCODE]'], expect.objectContaining(expectedMacros), diff --git a/test/vast_tracker.js b/test/vast_tracker.js index 3740b446..359f51cb 100644 --- a/test/vast_tracker.js +++ b/test/vast_tracker.js @@ -287,11 +287,11 @@ describe('VASTTracker', function () { describe('#errorWithCode', () => { before(() => { - this.Tracker.error( + util.track = function (URLTemplates, variables, options) { _eventsSent.push( - this.resolveURLTemplates(URLTemplates, macros, options) - ) - ); + this.resolveURLTemplates(URLTemplates, variables, options) + ); + }; }); beforeEach(() => { _eventsSent = []; From d4717faa40f22bcd0cde3b0b635d7661619ba1be Mon Sep 17 00:00:00 2001 From: Pauline M <67742551+PaulineMDaily@users.noreply.github.com> Date: Tue, 20 Oct 2020 15:07:15 +0200 Subject: [PATCH 06/14] fixed es-lint error --- src/vast_tracker.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/vast_tracker.js b/src/vast_tracker.js index 10a04ac0..9a57efc7 100644 --- a/src/vast_tracker.js +++ b/src/vast_tracker.js @@ -341,6 +341,7 @@ export class VASTTracker extends EventEmitter { errorWithCode(errorCode, isCustomCode = false) { this.error({ ERRORCODE: errorCode }, isCustomCode); + //eslint-disable-next-line console.log('errorWithCode : this method is deprecated'); } From 0374883134254c8a655000ece4de01a43c255375 Mon Sep 17 00:00:00 2001 From: Pauline M <67742551+PaulineMDaily@users.noreply.github.com> Date: Mon, 26 Oct 2020 18:42:03 +0100 Subject: [PATCH 07/14] modified UT and added JS doc --- spec/vast_trackers.spec.js | 23 ++++++++--------------- src/vast_tracker.js | 9 ++++----- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/spec/vast_trackers.spec.js b/spec/vast_trackers.spec.js index 53408233..7a02730d 100644 --- a/spec/vast_trackers.spec.js +++ b/spec/vast_trackers.spec.js @@ -13,8 +13,8 @@ describe('VASTTracker', function () { let spyTrack; let adTrackingUrls; let ad; - let isCustomCode = false; let spyAdError; + let isCustomCode; const expectedMacros = { ASSETURI: 'http%3A%2F%2Fexample.com%2Flinear-asset.mp4', UNIVERSALADID: 'sample-registry%20000123', @@ -286,13 +286,10 @@ describe('VASTTracker', function () { }); }); describe('#error', () => { - let isCustomCode = false; + isCustomCode = false; beforeEach(() => { vastTracker.error(); }); - it('should be defined', () => { - expect(ad.errorURLTemplates).toBeDefined(); - }); it('should have emitted an ad Error and called trackUrl ', () => { expect(spyTrackUrl).toHaveBeenCalledWith( ['http://example.com/error_[ERRORCODE]'], @@ -306,19 +303,15 @@ describe('VASTTracker', function () { beforeEach(() => { vastTracker.errorWithCode(); }); - it('should be defined', () => { - expect(ad.errorURLTemplates).toBeDefined(); - }); - it('should hava called the error method', () => { + isCustomCode = false; + it('should have called the error method', () => { expect(spyAdError).toHaveBeenCalledTimes(1); }); - it('should have emitted an ad error, called trackUrl and not emitted any other event', () => { - expect(spyTrackUrl).toHaveBeenCalledWith( - ['http://example.com/error_[ERRORCODE]'], - expect.objectContaining(expectedMacros), - expect.objectContaining({ isCustomCode }) + it('called the error method with the right arguments', () => { + expect(spyAdError).toHaveBeenCalledWith( + expect.objectContaining({ ...expectedMacros }), + isCustomCode ); - expect(spyTrackUrl).toHaveBeenCalledTimes(1); }); }); }); diff --git a/src/vast_tracker.js b/src/vast_tracker.js index 9a57efc7..f9f91478 100644 --- a/src/vast_tracker.js +++ b/src/vast_tracker.js @@ -308,7 +308,6 @@ export class VASTTracker extends EventEmitter { /** * Tracks an impression (can be called only once). * @param {Object} [macros={}] - An optional Object containing macros and their values to be used and replaced in the tracking calls. - * * @emits VASTTracker#creativeView */ trackImpression(macros = {}) { @@ -322,7 +321,6 @@ export class VASTTracker extends EventEmitter { /** * Send a request to the URI provided by the VAST element. * @param {Object} [macros={}] - An optional Object containing macros and their values to be used and replaced in the tracking calls. - * * @param {Boolean} [isCustomCode=false] - Flag to allow custom values on error code. */ @@ -333,8 +331,7 @@ export class VASTTracker extends EventEmitter { /** * Send a request to the URI provided by the VAST element. * If an [ERRORCODE] macro is included, it will be substitute with errorCode. - * This method is deprecated - * + * @deprecated * @param {String} errorCode - Replaces [ERRORCODE] macro. [ERRORCODE] values are listed in the VAST specification. * @param {Boolean} [isCustomCode=false] - Flag to allow custom values on error code. */ @@ -342,7 +339,9 @@ export class VASTTracker extends EventEmitter { errorWithCode(errorCode, isCustomCode = false) { this.error({ ERRORCODE: errorCode }, isCustomCode); //eslint-disable-next-line - console.log('errorWithCode : this method is deprecated'); + console.log( + 'The method errorWithCode is deprecated, please use vast tracker error method instead' + ); } /** From 3986710f390d1921696918dd45e623f60ea4a9e3 Mon Sep 17 00:00:00 2001 From: Pauline M <67742551+PaulineMDaily@users.noreply.github.com> Date: Tue, 27 Oct 2020 10:59:33 +0100 Subject: [PATCH 08/14] deleted break line --- src/vast_tracker.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/vast_tracker.js b/src/vast_tracker.js index f9f91478..7093d680 100644 --- a/src/vast_tracker.js +++ b/src/vast_tracker.js @@ -323,7 +323,6 @@ export class VASTTracker extends EventEmitter { * @param {Object} [macros={}] - An optional Object containing macros and their values to be used and replaced in the tracking calls. * @param {Boolean} [isCustomCode=false] - Flag to allow custom values on error code. */ - error(macros = {}, isCustomCode = false) { this.trackURLs(this.ad.errorURLTemplates, macros, { isCustomCode }); } @@ -335,7 +334,6 @@ export class VASTTracker extends EventEmitter { * @param {String} errorCode - Replaces [ERRORCODE] macro. [ERRORCODE] values are listed in the VAST specification. * @param {Boolean} [isCustomCode=false] - Flag to allow custom values on error code. */ - errorWithCode(errorCode, isCustomCode = false) { this.error({ ERRORCODE: errorCode }, isCustomCode); //eslint-disable-next-line From f33212234964f8b86d4d0e71ea857138734dce46 Mon Sep 17 00:00:00 2001 From: Pauline M <67742551+PaulineMDaily@users.noreply.github.com> Date: Wed, 28 Oct 2020 17:16:00 +0100 Subject: [PATCH 09/14] modified UT --- spec/vast_trackers.spec.js | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/spec/vast_trackers.spec.js b/spec/vast_trackers.spec.js index 7a02730d..0859b29f 100644 --- a/spec/vast_trackers.spec.js +++ b/spec/vast_trackers.spec.js @@ -13,8 +13,6 @@ describe('VASTTracker', function () { let spyTrack; let adTrackingUrls; let ad; - let spyAdError; - let isCustomCode; const expectedMacros = { ASSETURI: 'http%3A%2F%2Fexample.com%2Flinear-asset.mp4', UNIVERSALADID: 'sample-registry%20000123', @@ -30,7 +28,6 @@ describe('VASTTracker', function () { spyEmitter = jest.spyOn(vastTracker, 'emit'); spyTrackUrl = jest.spyOn(vastTracker, 'trackURLs'); spyTrack = jest.spyOn(vastTracker, 'track'); - spyAdError = jest.spyOn(vastTracker, 'error'); }); describe('#click', () => { @@ -286,31 +283,24 @@ describe('VASTTracker', function () { }); }); describe('#error', () => { - isCustomCode = false; - beforeEach(() => { + let isCustomCode = false; + it('should be called with the right arguments', () => { vastTracker.error(); - }); - it('should have emitted an ad Error and called trackUrl ', () => { expect(spyTrackUrl).toHaveBeenCalledWith( ['http://example.com/error_[ERRORCODE]'], expect.objectContaining(expectedMacros), - expect.objectContaining({ isCustomCode }) + { isCustomCode: false } ); - expect(spyTrackUrl).toHaveBeenCalledTimes(1); }); }); + describe('#errorWithCode', () => { - beforeEach(() => { + it('should be called with the right arguments', () => { vastTracker.errorWithCode(); - }); - isCustomCode = false; - it('should have called the error method', () => { - expect(spyAdError).toHaveBeenCalledTimes(1); - }); - it('called the error method with the right arguments', () => { - expect(spyAdError).toHaveBeenCalledWith( - expect.objectContaining({ ...expectedMacros }), - isCustomCode + expect(spyTrackUrl).toHaveBeenCalledWith( + ['http://example.com/error_[ERRORCODE]'], + expect.objectContaining(expectedMacros), + { isCustomCode: false } ); }); }); From 4dbae7f6c47e3d8b544c9b4d32ae248f4dd38242 Mon Sep 17 00:00:00 2001 From: Pauline M <67742551+PaulineMDaily@users.noreply.github.com> Date: Mon, 2 Nov 2020 16:05:21 +0100 Subject: [PATCH 10/14] modified test and make a copy of macros received as an argument --- spec/vast_trackers.spec.js | 14 ++++++-------- src/vast_tracker.js | 20 +++++++++++--------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/spec/vast_trackers.spec.js b/spec/vast_trackers.spec.js index 0859b29f..877e20ff 100644 --- a/spec/vast_trackers.spec.js +++ b/spec/vast_trackers.spec.js @@ -282,8 +282,8 @@ describe('VASTTracker', function () { expect(spyTrack).not.toHaveBeenCalledTimes(2); }); }); + describe('#error', () => { - let isCustomCode = false; it('should be called with the right arguments', () => { vastTracker.error(); expect(spyTrackUrl).toHaveBeenCalledWith( @@ -294,14 +294,12 @@ describe('VASTTracker', function () { }); }); - describe('#errorWithCode', () => { + fdescribe('#errorWithCode', () => { it('should be called with the right arguments', () => { - vastTracker.errorWithCode(); - expect(spyTrackUrl).toHaveBeenCalledWith( - ['http://example.com/error_[ERRORCODE]'], - expect.objectContaining(expectedMacros), - { isCustomCode: false } - ); + const spyError = jest.fn(); + vastTracker.error = spyError; + vastTracker.errorWithCode('1234', true); + expect(spyError).toHaveBeenCalledWith({ ERRORCODE: '1234' }, true); }); }); }); diff --git a/src/vast_tracker.js b/src/vast_tracker.js index 7093d680..27c3078a 100644 --- a/src/vast_tracker.js +++ b/src/vast_tracker.js @@ -605,6 +605,8 @@ export class VASTTracker extends EventEmitter { * @param {Object} [options={}] - An optional Object of options to be used in the tracking calls. */ trackURLs(URLTemplates, macros = {}, options = {}) { + //Avoid mutating the object received in parameters. + const givenMacros = { ...macros }; if (this.linear) { if ( this.creative && @@ -612,10 +614,10 @@ export class VASTTracker extends EventEmitter { this.creative.mediaFiles[0] && this.creative.mediaFiles[0].fileURL ) { - macros['ASSETURI'] = this.creative.mediaFiles[0].fileURL; + givenMacros['ASSETURI'] = this.creative.mediaFiles[0].fileURL; } if (this.progress) { - macros['ADPLAYHEAD'] = this.progressFormatted(); + givenMacros['ADPLAYHEAD'] = this.progressFormatted(); } } if ( @@ -624,32 +626,32 @@ export class VASTTracker extends EventEmitter { this.creative.universalAdId.idRegistry && this.creative.universalAdId.value ) { - macros[ + givenMacros[ 'UNIVERSALADID' ] = `${this.creative.universalAdId.idRegistry} ${this.creative.universalAdId.value}`; } if (this.ad) { if (this.ad.sequence) { - macros['PODSEQUENCE'] = this.ad.sequence; + givenMacros['PODSEQUENCE'] = this.ad.sequence; } if (this.ad.adType) { - macros['ADTYPE'] = this.ad.adType; + givenMacros['ADTYPE'] = this.ad.adType; } if (this.ad.adServingId) { - macros['ADSERVINGID'] = this.ad.adServingId; + givenMacros['ADSERVINGID'] = this.ad.adServingId; } if (this.ad.categories && this.ad.categories.length) { - macros['ADCATEGORIES'] = this.ad.categories + givenMacros['ADCATEGORIES'] = this.ad.categories .map((categorie) => categorie.value) .join(','); } if (this.ad.blockedAdCategories && this.ad.blockedAdCategories.length) { - macros['BLOCKEDADCATEGORIES'] = this.ad.blockedAdCategories; + givenMacros['BLOCKEDADCATEGORIES'] = this.ad.blockedAdCategories; } } - util.track(URLTemplates, macros, options); + util.track(URLTemplates, givenMacros, options); } /** From 24c7953df7f604e4173a22cfca9e480bfe0b4130 Mon Sep 17 00:00:00 2001 From: Pauline M <67742551+PaulineMDaily@users.noreply.github.com> Date: Tue, 3 Nov 2020 18:34:16 +0100 Subject: [PATCH 11/14] Modified UT --- spec/vast_trackers.spec.js | 47 +++++++++++++++++++++----------------- src/vast_tracker.js | 1 - 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/spec/vast_trackers.spec.js b/spec/vast_trackers.spec.js index 877e20ff..29bdcf8e 100644 --- a/spec/vast_trackers.spec.js +++ b/spec/vast_trackers.spec.js @@ -20,20 +20,24 @@ describe('VASTTracker', function () { ADSERVINGID: 'z292x16y-3d7f-6440-bd29-2ec0f153fc89', ADTYPE: 'video', ADCATEGORIES: 'Category-A%2CCategory-B%2CCategory-C', + ADPLAYHEAD: '01%3A15%3A05.250', }; + beforeEach(() => { ad = inlineTrackersParsed.ads[0]; adTrackingUrls = ad.creatives[0].trackingEvents; vastTracker = new VASTTracker(vastClient, ad, ad.creatives[0]); spyEmitter = jest.spyOn(vastTracker, 'emit'); spyTrackUrl = jest.spyOn(vastTracker, 'trackURLs'); + // spyTrackUrl = jest.fn(); + // vastTracker.trackURLs = spyTrackUrl; spyTrack = jest.spyOn(vastTracker, 'track'); }); describe('#click', () => { beforeEach(() => { vastTracker.setProgress(60 * 75 + 5.25); - vastTracker.click(); + vastTracker.click(null, expectedMacros); }); it('should have emitted click event and called trackUrl', () => { expect(spyEmitter).toHaveBeenCalledWith( @@ -53,7 +57,7 @@ describe('VASTTracker', function () { describe('#minimize', () => { beforeEach(() => { - vastTracker.minimize(); + vastTracker.minimize(expectedMacros); }); it('should be defined', () => { expect(adTrackingUrls.minimize).toBeDefined(); @@ -111,7 +115,7 @@ describe('VASTTracker', function () { describe('#otherAdInteraction', () => { beforeEach(() => { - vastTracker.otherAdInteraction(); + vastTracker.otherAdInteraction(expectedMacros); }); it('should be defined', () => { expect(adTrackingUrls.otherAdInteraction).toBeDefined(); @@ -129,7 +133,7 @@ describe('VASTTracker', function () { describe('#acceptInvitation', () => { beforeEach(() => { - vastTracker.acceptInvitation(); + vastTracker.acceptInvitation(expectedMacros); }); it('should be defined', () => { expect(adTrackingUrls.acceptInvitation).toBeDefined(); @@ -147,7 +151,7 @@ describe('VASTTracker', function () { describe('#adExpand', () => { beforeEach(() => { - vastTracker.adExpand(); + vastTracker.adExpand(expectedMacros); }); it('should be defined', () => { expect(adTrackingUrls.adExpand).toBeDefined(); @@ -165,7 +169,7 @@ describe('VASTTracker', function () { describe('#adCollapse', () => { beforeEach(() => { - vastTracker.adCollapse(); + vastTracker.adCollapse(expectedMacros); }); it('should be defined', () => { expect(adTrackingUrls.adCollapse).toBeDefined(); @@ -182,11 +186,14 @@ describe('VASTTracker', function () { }); describe('#overlayViewDuration', () => { + const overlayViewMacros = { + ADPLAYHEAD: '00:00:40', + CONTENTPLAYHEAD: '00:00:40', + MEDIAPLAYHEAD: '00:00:40', + ...expectedMacros, + }; beforeEach(() => { - vastTracker.overlayViewDuration('00:00:30', { - CONTENTPLAYHEAD: '00:00:40', - MEDIAPLAYHEAD: '00:00:40', - }); + vastTracker.overlayViewDuration('00:00:30', overlayViewMacros); }); it('should be defined', () => { expect(adTrackingUrls.overlayViewDuration).toBeDefined(); @@ -197,12 +204,10 @@ describe('VASTTracker', function () { }); expect(spyTrackUrl).toHaveBeenCalledWith( adTrackingUrls.overlayViewDuration, - expect.objectContaining({ - ...expectedMacros, - ADPLAYHEAD: '00%3A00%3A30', - CONTENTPLAYHEAD: '00%3A00%3A40', - MEDIAPLAYHEAD: '00%3A00%3A40', - }) + { + ...overlayViewMacros, + ADPLAYHEAD: '00:00:30', + } ); }); }); @@ -212,8 +217,8 @@ describe('VASTTracker', function () { expect(adTrackingUrls.notUsed).toBeDefined(); }); it('should have emitted adExpand event, called trackUrl and not emitted any other event', () => { - vastTracker.notUsed(); - vastTracker.adCollapse(); + vastTracker.notUsed(expectedMacros); + vastTracker.adCollapse(expectedMacros); expect(spyEmitter).toHaveBeenCalledWith('notUsed', { trackingURLTemplates: adTrackingUrls.notUsed, @@ -285,16 +290,16 @@ describe('VASTTracker', function () { describe('#error', () => { it('should be called with the right arguments', () => { - vastTracker.error(); + vastTracker.error(expectedMacros); expect(spyTrackUrl).toHaveBeenCalledWith( ['http://example.com/error_[ERRORCODE]'], - expect.objectContaining(expectedMacros), + expectedMacros, { isCustomCode: false } ); }); }); - fdescribe('#errorWithCode', () => { + describe('#errorWithCode', () => { it('should be called with the right arguments', () => { const spyError = jest.fn(); vastTracker.error = spyError; diff --git a/src/vast_tracker.js b/src/vast_tracker.js index 27c3078a..1057c0ec 100644 --- a/src/vast_tracker.js +++ b/src/vast_tracker.js @@ -650,7 +650,6 @@ export class VASTTracker extends EventEmitter { givenMacros['BLOCKEDADCATEGORIES'] = this.ad.blockedAdCategories; } } - util.track(URLTemplates, givenMacros, options); } From aa18059d5208f2970bafb6c1863b16b49aa974f7 Mon Sep 17 00:00:00 2001 From: Pauline M <67742551+PaulineMDaily@users.noreply.github.com> Date: Wed, 4 Nov 2020 17:51:02 +0100 Subject: [PATCH 12/14] added line break and deleted comments --- spec/vast_trackers.spec.js | 2 -- src/vast_tracker.js | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/spec/vast_trackers.spec.js b/spec/vast_trackers.spec.js index 29bdcf8e..582dc902 100644 --- a/spec/vast_trackers.spec.js +++ b/spec/vast_trackers.spec.js @@ -29,8 +29,6 @@ describe('VASTTracker', function () { vastTracker = new VASTTracker(vastClient, ad, ad.creatives[0]); spyEmitter = jest.spyOn(vastTracker, 'emit'); spyTrackUrl = jest.spyOn(vastTracker, 'trackURLs'); - // spyTrackUrl = jest.fn(); - // vastTracker.trackURLs = spyTrackUrl; spyTrack = jest.spyOn(vastTracker, 'track'); }); diff --git a/src/vast_tracker.js b/src/vast_tracker.js index 1057c0ec..27c3078a 100644 --- a/src/vast_tracker.js +++ b/src/vast_tracker.js @@ -650,6 +650,7 @@ export class VASTTracker extends EventEmitter { givenMacros['BLOCKEDADCATEGORIES'] = this.ad.blockedAdCategories; } } + util.track(URLTemplates, givenMacros, options); } From 105fafe89f536f8c56373ead2ec806ad99b52cbc Mon Sep 17 00:00:00 2001 From: Pauline M <67742551+PaulineMDaily@users.noreply.github.com> Date: Wed, 4 Nov 2020 18:09:13 +0100 Subject: [PATCH 13/14] modified UT for click and minimize --- spec/vast_trackers.spec.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/spec/vast_trackers.spec.js b/spec/vast_trackers.spec.js index 582dc902..812e7402 100644 --- a/spec/vast_trackers.spec.js +++ b/spec/vast_trackers.spec.js @@ -20,7 +20,6 @@ describe('VASTTracker', function () { ADSERVINGID: 'z292x16y-3d7f-6440-bd29-2ec0f153fc89', ADTYPE: 'video', ADCATEGORIES: 'Category-A%2CCategory-B%2CCategory-C', - ADPLAYHEAD: '01%3A15%3A05.250', }; beforeEach(() => { @@ -45,10 +44,7 @@ describe('VASTTracker', function () { expect(spyTrackUrl).toHaveBeenCalledWith( ad.creatives[0].videoClickTrackingURLTemplates, - expect.objectContaining({ - ...expectedMacros, - ADPLAYHEAD: '01%3A15%3A05.250', - }) + expectedMacros ); }); }); @@ -67,7 +63,7 @@ describe('VASTTracker', function () { expect(spyTrackUrl).toHaveBeenCalledWith( adTrackingUrls.minimize, - expect.objectContaining(expectedMacros) + expectedMacros ); }); }); From 52c7e821be0e98ca62c2d533387046b1ce541929 Mon Sep 17 00:00:00 2001 From: Pauline M <67742551+PaulineMDaily@users.noreply.github.com> Date: Fri, 6 Nov 2020 11:55:15 +0100 Subject: [PATCH 14/14] fixed last tests for readability --- spec/vast_trackers.spec.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/vast_trackers.spec.js b/spec/vast_trackers.spec.js index 812e7402..64cf269e 100644 --- a/spec/vast_trackers.spec.js +++ b/spec/vast_trackers.spec.js @@ -120,7 +120,7 @@ describe('VASTTracker', function () { }); expect(spyTrackUrl).toHaveBeenCalledWith( adTrackingUrls.otherAdInteraction, - expect.objectContaining(expectedMacros) + expectedMacros ); }); }); @@ -138,7 +138,7 @@ describe('VASTTracker', function () { }); expect(spyTrackUrl).toHaveBeenCalledWith( adTrackingUrls.acceptInvitation, - expect.objectContaining(expectedMacros) + expectedMacros ); }); }); @@ -156,7 +156,7 @@ describe('VASTTracker', function () { }); expect(spyTrackUrl).toHaveBeenCalledWith( adTrackingUrls.adExpand, - expect.objectContaining(expectedMacros) + expectedMacros ); }); }); @@ -174,7 +174,7 @@ describe('VASTTracker', function () { }); expect(spyTrackUrl).toHaveBeenCalledWith( adTrackingUrls.adCollapse, - expect.objectContaining(expectedMacros) + expectedMacros ); }); }); @@ -219,7 +219,7 @@ describe('VASTTracker', function () { }); expect(spyTrackUrl).toHaveBeenCalledWith( adTrackingUrls.notUsed, - expect.objectContaining(expectedMacros) + expectedMacros ); expect(spyEmitter).toHaveBeenCalledTimes(1); });