Commit ef32342f authored by lauraMon's avatar lauraMon Committed by Tristan Read

Adds extra spec

parent 82c8b065
......@@ -324,7 +324,7 @@ export default {
</div>
</template>
<template v-slot:ignore="errors">
<gl-button @click="updateIssueStatus(errors.item.id, 'ignored')">
<gl-button ref="ignoreError" @click="updateIssueStatus(errors.item.id, 'ignored')">
<gl-icon name="eye-slash" :size="12" />
</gl-button>
</template>
......
import { createLocalVue, mount } from '@vue/test-utils';
import Vuex from 'vuex';
import { GlEmptyState, GlLoadingIcon, GlFormInput, GlPagination } from '@gitlab/ui';
import { GlIcon, GlEmptyState, GlLoadingIcon, GlFormInput, GlPagination } from '@gitlab/ui';
import stubChildren from 'helpers/stub_children';
import ErrorTrackingList from '~/error_tracking/components/error_tracking_list.vue';
import errorsList from './list_mock.json';
......@@ -61,6 +61,7 @@ describe('ErrorTrackingList', () => {
searchByQuery: jest.fn(),
sortByField: jest.fn(),
fetchPaginatedResults: jest.fn(),
updateStatus: jest.fn(),
};
const state = {
......@@ -215,6 +216,35 @@ describe('ErrorTrackingList', () => {
});
});
describe('When the ignore button on an error is clicked', () => {
beforeEach(() => {
store.state.list.loading = false;
store.state.list.errors = errorsList;
mountComponent({
stubs: {
GlTable: false,
GlLink: false,
GlButton: false,
},
});
});
it('sends the status and error ID', () => {
const ignoreButton = wrapper.find({ ref: 'ignoreError' });
ignoreButton.trigger('click');
expect(actions.updateStatus).toHaveBeenCalledWith(
expect.anything(),
{
endpoint: '/project/test/-/error_tracking/3.json',
redirectUrl: '/error_tracking',
status: 'ignored',
},
undefined,
);
});
});
describe('When error tracking is disabled and user is not allowed to enable it', () => {
beforeEach(() => {
mountComponent({
......
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