refactor: explicit mocking for analytics (#41562)
The previous approach did avoid a fair number of jest.mock calls, but made debugging the tests harder. If you don't know about the mapping it's unclear why the imported module does not behave as normal. By forcing the use of jest.mock it means that the answer to that question is in the test you are working on.
This commit is contained in:
committed by
GitHub
parent
fb40f56876
commit
740370eb60
@ -1,4 +1,4 @@
|
||||
/* global expect */
|
||||
/* global expect jest */
|
||||
import React from 'react';
|
||||
import { Provider } from 'react-redux';
|
||||
import ShallowRenderer from 'react-test-renderer/shallow';
|
||||
@ -9,6 +9,8 @@ import FourOhFourPage from '../../src/pages/404';
|
||||
import Learn from '../../src/pages/learn';
|
||||
import Certification from '../../src/pages/certification';
|
||||
|
||||
jest.mock('../../src/analytics');
|
||||
|
||||
const store = createStore();
|
||||
function getComponentNameAndProps(elementType, pathname) {
|
||||
const shallow = new ShallowRenderer();
|
||||
|
Reference in New Issue
Block a user