2018-11-18 11:00:15 +05:30
|
|
|
import Vue from 'vue';
|
|
|
|
import Vuex from 'vuex';
|
2020-05-24 23:13:21 +05:30
|
|
|
import { mountComponentWithStore } from 'helpers/vue_mount_component_helper';
|
2020-01-01 13:55:28 +05:30
|
|
|
import component from '~/reports/components/modal_open_name.vue';
|
2018-11-18 11:00:15 +05:30
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
Vue.use(Vuex);
|
|
|
|
|
2018-11-18 11:00:15 +05:30
|
|
|
describe('Modal open name', () => {
|
|
|
|
const Component = Vue.extend(component);
|
|
|
|
let vm;
|
|
|
|
|
|
|
|
const store = new Vuex.Store({
|
|
|
|
actions: {
|
|
|
|
openModal: () => {},
|
|
|
|
},
|
|
|
|
state: {},
|
|
|
|
mutations: {},
|
|
|
|
});
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
vm = mountComponentWithStore(Component, {
|
|
|
|
store,
|
|
|
|
props: {
|
|
|
|
issue: {
|
|
|
|
title: 'Issue',
|
|
|
|
},
|
|
|
|
status: 'failed',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
vm.$destroy();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('renders the issue name', () => {
|
|
|
|
expect(vm.$el.textContent.trim()).toEqual('Issue');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('calls openModal actions when button is clicked', () => {
|
2020-05-24 23:13:21 +05:30
|
|
|
jest.spyOn(vm, 'openModal').mockImplementation(() => {});
|
2018-11-18 11:00:15 +05:30
|
|
|
|
|
|
|
vm.$el.click();
|
|
|
|
|
|
|
|
expect(vm.openModal).toHaveBeenCalled();
|
|
|
|
});
|
|
|
|
});
|