Commit 5369f800 authored by Alexander Turinske's avatar Alexander Turinske

Convert security dashboard component tests to jest

- as part of GitLab's initiative
- Relates to https://gitlab.com/gitlab-org/gitlab/-/issues/209127
- Relates to https://gitlab.com/groups/gitlab-org/-/epics/895
parent 93f07c47
import Vue from 'vue'; import Vue from 'vue';
import component from 'ee/security_dashboard/components/filters.vue'; import component from 'ee/security_dashboard/components/filters.vue';
import createStore from 'ee/security_dashboard/store'; import createStore from 'ee/security_dashboard/store';
import { mountComponentWithStore } from 'spec/helpers/vue_mount_component_helper'; import { mountComponentWithStore } from 'helpers/vue_mount_component_helper';
describe('Filter component', () => { describe('Filter component', () => {
let vm; let vm;
......
...@@ -2,7 +2,7 @@ import Vue from 'vue'; ...@@ -2,7 +2,7 @@ import Vue from 'vue';
import component from 'ee/security_dashboard/components/vulnerability_action_buttons.vue'; import component from 'ee/security_dashboard/components/vulnerability_action_buttons.vue';
import createStore from 'ee/security_dashboard/store'; import createStore from 'ee/security_dashboard/store';
import { mountComponentWithStore } from 'spec/helpers/vue_mount_component_helper'; import { mountComponentWithStore } from 'helpers/vue_mount_component_helper';
import { resetStore } from '../helpers'; import { resetStore } from '../helpers';
import mockDataVulnerabilities from '../store/vulnerabilities/data/mock_data_vulnerabilities'; import mockDataVulnerabilities from '../store/vulnerabilities/data/mock_data_vulnerabilities';
...@@ -29,7 +29,7 @@ describe('Security Dashboard Action Buttons', () => { ...@@ -29,7 +29,7 @@ describe('Security Dashboard Action Buttons', () => {
canDismissVulnerability: true, canDismissVulnerability: true,
}; };
vm = mountComponentWithStore(Component, { store, props }); vm = mountComponentWithStore(Component, { store, props });
spyOn(vm.$store, 'dispatch').and.returnValue(Promise.resolve()); jest.spyOn(vm.$store, 'dispatch').mockReturnValue(Promise.resolve());
}); });
afterEach(() => { afterEach(() => {
......
...@@ -58,7 +58,7 @@ describe('Vulnerability Chart Buttons', () => { ...@@ -58,7 +58,7 @@ describe('Vulnerability Chart Buttons', () => {
}); });
it('should call the clickHandler', () => { it('should call the clickHandler', () => {
spyOn(wrapper.vm, 'clickHandler').and.stub(); jest.spyOn(wrapper.vm, 'clickHandler');
wrapper.find('[data-days="30"].active').trigger('click', DAYS.THIRTY); wrapper.find('[data-days="30"].active').trigger('click', DAYS.THIRTY);
expect(wrapper.vm.clickHandler).toHaveBeenCalledWith(DAYS.THIRTY); expect(wrapper.vm.clickHandler).toHaveBeenCalledWith(DAYS.THIRTY);
......
import Vue from 'vue'; import Vue from 'vue';
import component from 'ee/security_dashboard/components/vulnerability_count_list.vue'; import component from 'ee/security_dashboard/components/vulnerability_count_list.vue';
import createStore from 'ee/security_dashboard/store'; import createStore from 'ee/security_dashboard/store';
import { mountComponentWithStore } from 'spec/helpers/vue_mount_component_helper'; import { mountComponentWithStore } from 'helpers/vue_mount_component_helper';
import { resetStore } from '../helpers'; import { resetStore } from '../helpers';
import mockData from '../store/vulnerabilities/data/mock_data_vulnerabilities_count.json'; import mockData from '../store/vulnerabilities/data/mock_data_vulnerabilities_count.json';
......
import Vue from 'vue'; import Vue from 'vue';
import component from 'ee/security_dashboard/components/vulnerability_count.vue'; import component from 'ee/security_dashboard/components/vulnerability_count.vue';
import mountComponent from 'spec/helpers/vue_mount_component_helper'; import mountComponent from 'helpers/vue_mount_component_helper';
describe('Vulnerability Count', () => { describe('Vulnerability Count', () => {
const Component = Vue.extend(component); const Component = Vue.extend(component);
......
import Vue from 'vue'; import Vue from 'vue';
import component from 'ee/security_dashboard/components/vulnerability_issue_link.vue'; import component from 'ee/security_dashboard/components/vulnerability_issue_link.vue';
import mountComponent from 'spec/helpers/vue_mount_component_helper'; import mountComponent from 'helpers/vue_mount_component_helper';
describe('Vulnerability Issue Link component', () => { describe('Vulnerability Issue Link component', () => {
const Component = Vue.extend(component); const Component = Vue.extend(component);
......
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