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,8 +1,12 @@
|
||||
/* global jest */
|
||||
|
||||
import { types } from '.';
|
||||
import { createGaSaga } from './ga-saga';
|
||||
import ga from '../analytics';
|
||||
import { expectSaga } from 'redux-saga-test-plan';
|
||||
|
||||
jest.mock('../analytics');
|
||||
|
||||
describe('ga-saga', () => {
|
||||
it('calls GA after executeGA action', () => {
|
||||
const GaTypes = { event: ga.event, page: ga.pageview, modal: ga.modalview };
|
||||
|
Reference in New Issue
Block a user