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 {
};
},
mounted() {
this.trackOnShow();
this.track();
this.disableModalFromRenderingAgain();
},
methods: {
trackOnShow() {
this.track();
},
disableModalFromRenderingAgain() {
Cookies.remove(this.commitCookie);
},
......
......@@ -8,8 +8,12 @@ import modalProps from './pipeline_tour_success_mock_data';
describe('PipelineTourSuccessModal', () => {
let wrapper;
let cookieSpy;
let trackingSpy;
beforeEach(() => {
document.body.dataset.page = 'projects:blob:show';
trackingSpy = mockTracking('_category_', undefined, jest.spyOn);
wrapper = shallowMount(pipelineTourSuccess, {
propsData: modalProps,
});
......@@ -19,6 +23,7 @@ describe('PipelineTourSuccessModal', () => {
afterEach(() => {
wrapper.destroy();
unmockTracking();
});
it('has expected structure', () => {
......@@ -36,21 +41,7 @@ describe('PipelineTourSuccessModal', () => {
});
describe('tracking', () => {
let trackingSpy;
beforeEach(() => {
trackingSpy = mockTracking('_category_', wrapper.element, jest.spyOn);
});
afterEach(() => {
unmockTracking();
});
it('send event for basic view of popover', () => {
document.body.dataset.page = 'projects:blob:show';
wrapper.vm.trackOnShow();
expect(trackingSpy).toHaveBeenCalledWith(undefined, undefined, {
label: 'congratulate_first_pipeline',
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