unit tests
This commit is contained in:
parent
694a3aabc7
commit
a14e3ca682
3 changed files with 2 additions and 11 deletions
|
|
@ -23,6 +23,7 @@ export function getMountOptions(mockData) {
|
||||||
mocks.pushPageViewToGA = jest.fn();
|
mocks.pushPageViewToGA = jest.fn();
|
||||||
mocks.logEvent = jest.fn();
|
mocks.logEvent = jest.fn();
|
||||||
mocks.pushExperimentsToDataLayer = jest.fn();
|
mocks.pushExperimentsToDataLayer = jest.fn();
|
||||||
|
mocks.prependActionToMethod = jest.fn();
|
||||||
|
|
||||||
mocks.dispatchStoreAction = jest.fn();
|
mocks.dispatchStoreAction = jest.fn();
|
||||||
mocks.dispatchStoreAction.mockImplementation((actionName) => {
|
mocks.dispatchStoreAction.mockImplementation((actionName) => {
|
||||||
|
|
|
||||||
|
|
@ -82,16 +82,7 @@ export default {
|
||||||
pushToDataLayerIfDefined(experimentWithDimension);
|
pushToDataLayerIfDefined(experimentWithDimension);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
appendActionToMethod(object, method, actionToAppend) {
|
|
||||||
const baseMethod = object[method.name];
|
|
||||||
object[method.name] = function () {
|
|
||||||
var result = baseMethod.apply(object, arguments);
|
|
||||||
actionToAppend.apply(this, arguments);
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
prependActionToMethod(object, method, actionToPrepend) {
|
prependActionToMethod(object, method, actionToPrepend) {
|
||||||
const baseMethod = object[method.name];
|
const baseMethod = object[method.name];
|
||||||
object[method.name] = function () {
|
object[method.name] = function () {
|
||||||
|
|
|
||||||
|
|
@ -79,5 +79,4 @@ describe("analyticsMixin.js", () => {
|
||||||
expect(window.dataLayer).toEqual([ { settings_5: {"Google Custom Dimension Index": "5"}, variationName_5: 'test', universeName_5: 'testUniverse' } ]);
|
expect(window.dataLayer).toEqual([ { settings_5: {"Google Custom Dimension Index": "5"}, variationName_5: 'test', universeName_5: 'testUniverse' } ]);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
Loading…
Reference in a new issue