Commit c1deee21 authored by Dave Pisek's avatar Dave Pisek

Specs: Shallow mount where possible

* Adds shallowMount factory
* Uses it in places where possible
parent 704df448
import { createWrapper, mount } from '@vue/test-utils';
import { createWrapper, mount, shallowMount } from '@vue/test-utils';
import { GlButton } from '@gitlab/ui';
import { extendedWrapper } from 'helpers/vue_test_utils_helper';
import VulnerabilityActionButtons, {
......@@ -14,13 +14,17 @@ describe('Security Dashboard Action Buttons', () => {
let store;
let wrapper;
const createComponent = ({ ...options }) =>
const wrapperFactory = (mountFn) => ({ ...options }) =>
extendedWrapper(
mount(VulnerabilityActionButtons, {
mountFn(VulnerabilityActionButtons, {
...options,
store,
}),
);
const createShallowComponent = wrapperFactory(shallowMount);
const createFullComponent = wrapperFactory(mount);
const findAllButtons = () => wrapper.findAllComponents(GlButton);
const findMoreInfoButton = () => wrapper.findByTestId('more-info');
const findCreateIssueButton = () => wrapper.findByTestId('create-issue');
......@@ -38,7 +42,7 @@ describe('Security Dashboard Action Buttons', () => {
describe('with a fresh vulnerability', () => {
beforeEach(() => {
wrapper = createComponent({
wrapper = createFullComponent({
propsData: {
vulnerability: mockDataVulnerabilities[0],
canCreateIssue: true,
......@@ -90,7 +94,7 @@ describe('Security Dashboard Action Buttons', () => {
describe('with Jira issues for vulnerabilities enabled', () => {
beforeEach(() => {
wrapper = createComponent({
wrapper = createFullComponent({
propsData: {
vulnerability: mockDataVulnerabilities[8],
canCreateIssue: true,
......@@ -140,7 +144,7 @@ describe('Security Dashboard Action Buttons', () => {
describe('with a vulnerability that has an issue', () => {
beforeEach(() => {
wrapper = createComponent({
wrapper = createShallowComponent({
propsData: {
vulnerability: mockDataVulnerabilities[3],
},
......@@ -158,7 +162,7 @@ describe('Security Dashboard Action Buttons', () => {
describe('with a vulnerability that has been dismissed', () => {
beforeEach(() => {
wrapper = createComponent({
wrapper = createShallowComponent({
propsData: {
vulnerability: mockDataVulnerabilities[2],
canDismissVulnerability: true,
......
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