Commit ced30f5b authored by Fatih Acet's avatar Fatih Acet

Merge branch 'winh-jest-security_reports-ee' into 'master'

Migrate security reports tests to Jest

Closes #10722 and #10724

See merge request gitlab-org/gitlab-ee!10466
parents 05513ff5 21fbfe27
import Vue from 'vue';
import component from 'ee/vue_shared/security_reports/components/dast_issue_body.vue';
import mountComponent from 'spec/helpers/vue_mount_component_helper';
import mountComponent from 'helpers/vue_mount_component_helper';
describe('dast issue body', () => {
let vm;
......
import Vue from 'vue';
import component from 'ee/vue_shared/security_reports/components/event_item.vue';
import mountComponent from 'spec/helpers/vue_mount_component_helper';
import mountComponent from 'helpers/vue_mount_component_helper';
describe('Event Item', () => {
const Component = Vue.extend(component);
......
import Vue from 'vue';
import component from 'ee/vue_shared/security_reports/components/modal.vue';
import createState from 'ee/vue_shared/security_reports/store/state';
import mountComponent from 'spec/helpers/vue_mount_component_helper';
import mountComponent from 'helpers/vue_mount_component_helper';
describe('Security Reports modal', () => {
const Component = Vue.extend(component);
......@@ -36,7 +36,7 @@ describe('Security Reports modal', () => {
});
it('emits revertDismissIssue when undo dismiss button is clicked', () => {
spyOn(vm, '$emit');
jest.spyOn(vm, '$emit');
const button = vm.$el.querySelector('.js-dismiss-btn');
button.click();
......@@ -73,7 +73,7 @@ describe('Security Reports modal', () => {
});
it('emits dismissIssue when dismiss issue button is clicked', () => {
spyOn(vm, '$emit');
jest.spyOn(vm, '$emit');
const button = vm.$el.querySelector('.js-dismiss-btn');
button.click();
......@@ -104,7 +104,7 @@ describe('Security Reports modal', () => {
});
it('emits createIssue when create issue button is clicked', () => {
spyOn(vm, '$emit');
jest.spyOn(vm, '$emit');
const button = vm.$el.querySelector('.js-action-button');
button.click();
......
import Vue from 'vue';
import component from 'ee/vue_shared/security_reports/components/sast_container_issue_body.vue';
import mountComponent from 'spec/helpers/vue_mount_component_helper';
import mountComponent from 'helpers/vue_mount_component_helper';
describe('sast container issue body', () => {
let vm;
......
import Vue from 'vue';
import component from 'ee/vue_shared/security_reports/components/sast_issue_body.vue';
import mountComponent from 'spec/helpers/vue_mount_component_helper';
import mountComponent from 'helpers/vue_mount_component_helper';
import { STATUS_FAILED } from '~/reports/constants';
describe('sast issue body', () => {
......
import Vue from 'vue';
import component from 'ee/vue_shared/security_reports/components/solution_card.vue';
import mountComponent from 'spec/helpers/vue_mount_component_helper';
import { trimText } from 'spec/helpers/vue_component_helper';
import mountComponent from 'helpers/vue_mount_component_helper';
import { trimText } from 'helpers/vue_component_helper';
describe('Solution Card', () => {
const Component = Vue.extend(component);
......
import Vue from 'vue';
import component from 'ee/vue_shared/security_reports/components/split_button.vue';
import mountComponent from 'spec/helpers/vue_mount_component_helper';
import mountComponent from 'helpers/vue_mount_component_helper';
describe('Split Button', () => {
const Component = Vue.extend(component);
......@@ -46,7 +46,7 @@ describe('Split Button', () => {
});
it('emits the correct event when the button is pressed', () => {
spyOn(vm, '$emit');
jest.spyOn(vm, '$emit');
vm.$el.querySelector('.btn').click();
......
This diff is collapsed.
......@@ -22,6 +22,11 @@ import {
parsedDastNewIssues,
parsedDast,
} from '../mock_data';
import { visitUrl } from '~/lib/utils/url_utility';
jest.mock('~/lib/utils/url_utility', () => ({
visitUrl: jest.fn().mockName('visitUrlMock'),
}));
describe('security reports mutations', () => {
let stateCopy;
......@@ -511,7 +516,6 @@ describe('security reports mutations', () => {
describe('RECEIVE_CREATE_MERGE_REQUEST_SUCCESS', () => {
it('should fire the visitUrl function on the merge request URL', () => {
const payload = { merge_request_path: 'fakepath.html' };
const visitUrl = spyOnDependency(mutations, 'visitUrl');
mutations[types.RECEIVE_CREATE_MERGE_REQUEST_SUCCESS](stateCopy, payload);
expect(visitUrl).toHaveBeenCalledWith(payload.merge_request_path);
......
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