Allow optional value to be passed in

This commit is contained in:
Blade Barringer
2015-07-19 08:33:44 -05:00
parent deac9619bc
commit b49995c676
2 changed files with 59 additions and 1 deletions

View File

@@ -170,6 +170,47 @@ describe('analytics', function() {
el: 'some label'
});
});
it('if goldCost property is provided, use as value', function() {
analyticsData.goldCost = 5;
initializedAnalytics.track(event_type, analyticsData);
expect(googleEvent).to.be.calledOnce;
expect(googleEvent).to.be.calledWith({
ec: 'behavior',
ea: 'Cron',
ev: 5
});
});
it('if gemCost property is provided, use as value (overrides goldCost)', function() {
analyticsData.gemCost = 7;
analyticsData.goldCost = 5;
initializedAnalytics.track(event_type, analyticsData);
expect(googleEvent).to.be.calledOnce;
expect(googleEvent).to.be.calledWith({
ec: 'behavior',
ea: 'Cron',
ev: 7
});
});
it('if gaValue property is provided, use as value (overrides gemCost)', function() {
analyticsData.gemCost = 7;
analyticsData.gaValue = 5;
initializedAnalytics.track(event_type, analyticsData);
expect(googleEvent).to.be.calledOnce;
expect(googleEvent).to.be.calledWith({
ec: 'behavior',
ea: 'Cron',
ev: 5
});
});
});
});