Commit 2161c724 authored by Doug Stull's avatar Doug Stull

Test true mounting lifecycle hook

- before we weren't testing the actual mounting life cycle
  now we are.
parent 65538ce3
...@@ -50,13 +50,10 @@ export default { ...@@ -50,13 +50,10 @@ export default {
}; };
}, },
mounted() { mounted() {
this.trackOnShow(); this.track();
this.disableModalFromRenderingAgain(); this.disableModalFromRenderingAgain();
}, },
methods: { methods: {
trackOnShow() {
this.track();
},
disableModalFromRenderingAgain() { disableModalFromRenderingAgain() {
Cookies.remove(this.commitCookie); Cookies.remove(this.commitCookie);
}, },
......
...@@ -8,8 +8,12 @@ import modalProps from './pipeline_tour_success_mock_data'; ...@@ -8,8 +8,12 @@ import modalProps from './pipeline_tour_success_mock_data';
describe('PipelineTourSuccessModal', () => { describe('PipelineTourSuccessModal', () => {
let wrapper; let wrapper;
let cookieSpy; let cookieSpy;
let trackingSpy;
beforeEach(() => { beforeEach(() => {
document.body.dataset.page = 'projects:blob:show';
trackingSpy = mockTracking('_category_', undefined, jest.spyOn);
wrapper = shallowMount(pipelineTourSuccess, { wrapper = shallowMount(pipelineTourSuccess, {
propsData: modalProps, propsData: modalProps,
}); });
...@@ -19,6 +23,7 @@ describe('PipelineTourSuccessModal', () => { ...@@ -19,6 +23,7 @@ describe('PipelineTourSuccessModal', () => {
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
unmockTracking();
}); });
it('has expected structure', () => { it('has expected structure', () => {
...@@ -36,21 +41,7 @@ describe('PipelineTourSuccessModal', () => { ...@@ -36,21 +41,7 @@ describe('PipelineTourSuccessModal', () => {
}); });
describe('tracking', () => { describe('tracking', () => {
let trackingSpy;
beforeEach(() => {
trackingSpy = mockTracking('_category_', wrapper.element, jest.spyOn);
});
afterEach(() => {
unmockTracking();
});
it('send event for basic view of popover', () => { it('send event for basic view of popover', () => {
document.body.dataset.page = 'projects:blob:show';
wrapper.vm.trackOnShow();
expect(trackingSpy).toHaveBeenCalledWith(undefined, undefined, { expect(trackingSpy).toHaveBeenCalledWith(undefined, undefined, {
label: 'congratulate_first_pipeline', label: 'congratulate_first_pipeline',
property: modalProps.humanAccess, property: modalProps.humanAccess,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment