Cleaning up console.log calls in tests
This commit is contained in:
parent
8ba954c743
commit
e71f1b4cc2
@ -38,6 +38,7 @@ describe('setupAnalytics', () => {
|
|||||||
describe('when "Do Not Track" is set', () => {
|
describe('when "Do Not Track" is set', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
navigator.doNotTrack = '1';
|
navigator.doNotTrack = '1';
|
||||||
|
jest.spyOn(global.console, 'log').mockImplementation(Function.prototype);
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@ -53,5 +54,10 @@ describe('setupAnalytics', () => {
|
|||||||
setupAnalytics();
|
setupAnalytics();
|
||||||
expect(ReactGA.pageview).not.toHaveBeenCalled();
|
expect(ReactGA.pageview).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('logs a message', () => {
|
||||||
|
setupAnalytics();
|
||||||
|
expect(global.console.log).toHaveBeenCalledWith('Google Analytics disabled by Do Not Track');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -49,6 +49,7 @@ describe('setupRaven', () => {
|
|||||||
describe('when "Do Not Track" is set', () => {
|
describe('when "Do Not Track" is set', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
navigator.doNotTrack = '1';
|
navigator.doNotTrack = '1';
|
||||||
|
jest.spyOn(global.console, 'log').mockImplementation(Function.prototype);
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@ -59,5 +60,10 @@ describe('setupRaven', () => {
|
|||||||
setupRaven();
|
setupRaven();
|
||||||
expect(Raven.config).not.toHaveBeenCalled();
|
expect(Raven.config).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('logs a message', () => {
|
||||||
|
setupRaven();
|
||||||
|
expect(global.console.log).toHaveBeenCalledWith('Sentry error reporting disabled by Do Not Track');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user