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

Adds extra spec

parent 82c8b065
...@@ -324,7 +324,7 @@ export default { ...@@ -324,7 +324,7 @@ export default {
</div> </div>
</template> </template>
<template v-slot:ignore="errors"> <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-icon name="eye-slash" :size="12" />
</gl-button> </gl-button>
</template> </template>
......
import { createLocalVue, mount } from '@vue/test-utils'; import { createLocalVue, mount } from '@vue/test-utils';
import Vuex from 'vuex'; 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 stubChildren from 'helpers/stub_children';
import ErrorTrackingList from '~/error_tracking/components/error_tracking_list.vue'; import ErrorTrackingList from '~/error_tracking/components/error_tracking_list.vue';
import errorsList from './list_mock.json'; import errorsList from './list_mock.json';
...@@ -61,6 +61,7 @@ describe('ErrorTrackingList', () => { ...@@ -61,6 +61,7 @@ describe('ErrorTrackingList', () => {
searchByQuery: jest.fn(), searchByQuery: jest.fn(),
sortByField: jest.fn(), sortByField: jest.fn(),
fetchPaginatedResults: jest.fn(), fetchPaginatedResults: jest.fn(),
updateStatus: jest.fn(),
}; };
const state = { const state = {
...@@ -215,6 +216,35 @@ describe('ErrorTrackingList', () => { ...@@ -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', () => { describe('When error tracking is disabled and user is not allowed to enable it', () => {
beforeEach(() => { beforeEach(() => {
mountComponent({ 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