mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-04-14 19:56:23 +00:00
Convert analytics service to use sinon.sandbox
This commit is contained in:
parent
c7615e1cbd
commit
ab53391fee
1 changed files with 9 additions and 30 deletions
|
|
@ -15,11 +15,7 @@ describe('Analytics Service', function () {
|
|||
context('error handling', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
sinon.stub(console, 'log');
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
console.log.restore();
|
||||
sandbox.stub(console, 'log');
|
||||
});
|
||||
|
||||
it('does not accept tracking events without required properties', function() {
|
||||
|
|
@ -42,15 +38,9 @@ describe('Analytics Service', function () {
|
|||
context('Amplitude', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
sinon.stub(amplitude, 'setUserId');
|
||||
sinon.stub(amplitude, 'logEvent');
|
||||
sinon.stub(amplitude, 'setUserProperties');
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
amplitude.setUserId.restore();
|
||||
amplitude.logEvent.restore();
|
||||
amplitude.setUserProperties.restore();
|
||||
sandbox.stub(amplitude, 'setUserId');
|
||||
sandbox.stub(amplitude, 'logEvent');
|
||||
sandbox.stub(amplitude, 'setUserProperties');
|
||||
});
|
||||
|
||||
it('sets up tracking when user registers', function() {
|
||||
|
|
@ -85,11 +75,7 @@ describe('Analytics Service', function () {
|
|||
context('Google Analytics', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
sinon.stub(window, 'ga');
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
window.ga.restore();
|
||||
sandbox.stub(window, 'ga');
|
||||
});
|
||||
|
||||
it('sets up tracking when user registers', function() {
|
||||
|
|
@ -126,17 +112,10 @@ describe('Analytics Service', function () {
|
|||
context.skip('Mixpanel', function() { // Mixpanel not currently in use
|
||||
|
||||
beforeEach(function() {
|
||||
sinon.stub(mixpanel, 'alias');
|
||||
sinon.stub(mixpanel, 'identify');
|
||||
sinon.stub(mixpanel, 'track');
|
||||
sinon.stub(mixpanel, 'register');
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
mixpanel.alias.restore();
|
||||
mixpanel.identify.restore();
|
||||
mixpanel.track.restore();
|
||||
mixpanel.register.restore();
|
||||
sandbox.stub(mixpanel, 'alias');
|
||||
sandbox.stub(mixpanel, 'identify');
|
||||
sandbox.stub(mixpanel, 'track');
|
||||
sandbox.stub(mixpanel, 'register');
|
||||
});
|
||||
|
||||
it('sets up tracking when user registers', function() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue