diff --git a/src/setup/analytics.test.js b/src/setup/analytics.test.js index 48ce61b..97c043d 100644 --- a/src/setup/analytics.test.js +++ b/src/setup/analytics.test.js @@ -38,6 +38,7 @@ describe('setupAnalytics', () => { describe('when "Do Not Track" is set', () => { beforeEach(() => { navigator.doNotTrack = '1'; + jest.spyOn(global.console, 'log').mockImplementation(Function.prototype); }); afterEach(() => { @@ -53,5 +54,10 @@ describe('setupAnalytics', () => { setupAnalytics(); expect(ReactGA.pageview).not.toHaveBeenCalled(); }); + + it('logs a message', () => { + setupAnalytics(); + expect(global.console.log).toHaveBeenCalledWith('Google Analytics disabled by Do Not Track'); + }); }); }); diff --git a/src/setup/raven.test.js b/src/setup/raven.test.js index 87b2c70..e783405 100644 --- a/src/setup/raven.test.js +++ b/src/setup/raven.test.js @@ -49,6 +49,7 @@ describe('setupRaven', () => { describe('when "Do Not Track" is set', () => { beforeEach(() => { navigator.doNotTrack = '1'; + jest.spyOn(global.console, 'log').mockImplementation(Function.prototype); }); afterEach(() => { @@ -59,5 +60,10 @@ describe('setupRaven', () => { setupRaven(); expect(Raven.config).not.toHaveBeenCalled(); }); + + it('logs a message', () => { + setupRaven(); + expect(global.console.log).toHaveBeenCalledWith('Sentry error reporting disabled by Do Not Track'); + }); }); });