* feat: add email to A/B function * fix: declare types for sha-1 * Update client/src/utils/A-B-tester.ts Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com> * feat: add custom dimesions for donation events * feat: re-order if statemetns * Apply suggestions from code review Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com> * fix: assuage TypeScript * update rename * rename vars * update naming * re add types * Update client/src/redux/ga-saga.js Co-authored-by: Shaun Hamilton <shauhami020@gmail.com> Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com> Co-authored-by: Shaun Hamilton <shauhami020@gmail.com>
31 lines
892 B
JavaScript
31 lines
892 B
JavaScript
import { expectSaga } from 'redux-saga-test-plan';
|
|
import ga from '../analytics';
|
|
import { actionTypes } from './action-types';
|
|
import { createGaSaga } from './ga-saga';
|
|
|
|
jest.mock('../analytics');
|
|
|
|
describe('ga-saga', () => {
|
|
it('calls GA after executeGA action', () => {
|
|
const GaTypes = { event: ga.event, page: ga.pageview, modal: ga.modalview };
|
|
const mockEventPayload = {
|
|
type: 'event',
|
|
data: {
|
|
category: 'Map Challenge Click',
|
|
action: '/learn'
|
|
}
|
|
};
|
|
return (
|
|
expectSaga(createGaSaga, actionTypes)
|
|
// Assert that the `call` with expected paramater will eventually happen.
|
|
.call(GaTypes.event, mockEventPayload.data)
|
|
|
|
// Dispatch any actions that the saga will `take`.
|
|
.dispatch({ type: actionTypes.executeGA, payload: mockEventPayload })
|
|
|
|
// Start the test.
|
|
.run()
|
|
);
|
|
});
|
|
});
|