| ... | @@ -3,6 +3,7 @@ import Vuex from 'vuex'; |
... | @@ -3,6 +3,7 @@ import Vuex from 'vuex'; |
|
|
import { GlEmptyState, GlLoadingIcon, GlFormInput, GlPagination, GlDropdown } from '@gitlab/ui';
|
|
import { GlEmptyState, GlLoadingIcon, GlFormInput, GlPagination, GlDropdown } 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 ErrorTrackingActions from '~/error_tracking/components/error_tracking_actions.vue';
|
|
|
import errorsList from './list_mock.json';
|
|
import errorsList from './list_mock.json';
|
|
|
|
|
|
|
|
const localVue = createLocalVue();
|
|
const localVue = createLocalVue();
|
| ... | @@ -30,6 +31,7 @@ describe('ErrorTrackingList', () => { |
... | @@ -30,6 +31,7 @@ describe('ErrorTrackingList', () => { |
|
|
.find(GlDropdown);
|
|
.find(GlDropdown);
|
|
|
const findLoadingIcon = () => wrapper.find(GlLoadingIcon);
|
|
const findLoadingIcon = () => wrapper.find(GlLoadingIcon);
|
|
|
const findPagination = () => wrapper.find(GlPagination);
|
|
const findPagination = () => wrapper.find(GlPagination);
|
|
|
|
const findErrorActions = () => wrapper.find(ErrorTrackingActions);
|
|
|
|
|
|
|
|
function mountComponent({
|
|
function mountComponent({
|
|
|
errorTrackingEnabled = true,
|
|
errorTrackingEnabled = true,
|
| ... | @@ -151,15 +153,9 @@ describe('ErrorTrackingList', () => { |
... | @@ -151,15 +153,9 @@ describe('ErrorTrackingList', () => { |
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
it('each error in the list should have an ignore button', () => {
|
|
it('each error in the list should have an action button set', () => {
|
|
|
findErrorListRows().wrappers.forEach(row => {
|
|
findErrorListRows().wrappers.forEach(row => {
|
|
|
expect(row.contains('glicon-stub[name="eye-slash"]')).toBe(true);
|
|
expect(row.contains(ErrorTrackingActions)).toBe(true);
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('each error in the list should have a resolve button', () => {
|
|
|
|
|
findErrorListRows().wrappers.forEach(row => {
|
|
|
|
|
expect(row.contains('glicon-stub[name="check-circle"]')).toBe(true);
|
|
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
|
| ... | @@ -237,8 +233,6 @@ describe('ErrorTrackingList', () => { |
... | @@ -237,8 +233,6 @@ describe('ErrorTrackingList', () => { |
|
|
});
|
|
});
|
|
|
|
|
|
|
|
describe('When the ignore button on an error is clicked', () => {
|
|
describe('When the ignore button on an error is clicked', () => {
|
|
|
const ignoreErrorButton = () => wrapper.find({ ref: 'ignoreError' });
|
|
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
beforeEach(() => {
|
|
|
store.state.list.loading = false;
|
|
store.state.list.loading = false;
|
|
|
store.state.list.errors = errorsList;
|
|
store.state.list.errors = errorsList;
|
| ... | @@ -253,7 +247,10 @@ describe('ErrorTrackingList', () => { |
... | @@ -253,7 +247,10 @@ describe('ErrorTrackingList', () => { |
|
|
});
|
|
});
|
|
|
|
|
|
|
|
it('sends the "ignored" status and error ID', () => {
|
|
it('sends the "ignored" status and error ID', () => {
|
|
|
ignoreErrorButton().trigger('click');
|
|
findErrorActions().vm.$emit('update-issue-status', {
|
|
|
|
errorId: errorsList[0].id,
|
|
|
|
status: 'ignored',
|
|
|
|
});
|
|
|
expect(actions.updateStatus).toHaveBeenCalledWith(
|
|
expect(actions.updateStatus).toHaveBeenCalledWith(
|
|
|
expect.anything(),
|
|
expect.anything(),
|
|
|
{
|
|
{
|
| ... | @@ -265,7 +262,7 @@ describe('ErrorTrackingList', () => { |
... | @@ -265,7 +262,7 @@ describe('ErrorTrackingList', () => { |
|
|
});
|
|
});
|
|
|
|
|
|
|
|
it('calls an action to remove the item from the list', () => {
|
|
it('calls an action to remove the item from the list', () => {
|
|
|
ignoreErrorButton().trigger('click');
|
|
findErrorActions().vm.$emit('update-issue-status', { errorId: '1', status: undefined });
|
|
|
expect(actions.removeIgnoredResolvedErrors).toHaveBeenCalledWith(
|
|
expect(actions.removeIgnoredResolvedErrors).toHaveBeenCalledWith(
|
|
|
expect.anything(),
|
|
expect.anything(),
|
|
|
'1',
|
|
'1',
|
| ... | @@ -275,8 +272,6 @@ describe('ErrorTrackingList', () => { |
... | @@ -275,8 +272,6 @@ describe('ErrorTrackingList', () => { |
|
|
});
|
|
});
|
|
|
|
|
|
|
|
describe('When the resolve button on an error is clicked', () => {
|
|
describe('When the resolve button on an error is clicked', () => {
|
|
|
const resolveErrorButton = () => wrapper.find({ ref: 'resolveError' });
|
|
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
beforeEach(() => {
|
|
|
store.state.list.loading = false;
|
|
store.state.list.loading = false;
|
|
|
store.state.list.errors = errorsList;
|
|
store.state.list.errors = errorsList;
|
| ... | @@ -291,7 +286,10 @@ describe('ErrorTrackingList', () => { |
... | @@ -291,7 +286,10 @@ describe('ErrorTrackingList', () => { |
|
|
});
|
|
});
|
|
|
|
|
|
|
|
it('sends "resolved" status and error ID', () => {
|
|
it('sends "resolved" status and error ID', () => {
|
|
|
resolveErrorButton().trigger('click');
|
|
findErrorActions().vm.$emit('update-issue-status', {
|
|
|
|
errorId: errorsList[0].id,
|
|
|
|
status: 'resolved',
|
|
|
|
});
|
|
|
expect(actions.updateStatus).toHaveBeenCalledWith(
|
|
expect(actions.updateStatus).toHaveBeenCalledWith(
|
|
|
expect.anything(),
|
|
expect.anything(),
|
|
|
{
|
|
{
|
| ... | @@ -303,7 +301,7 @@ describe('ErrorTrackingList', () => { |
... | @@ -303,7 +301,7 @@ describe('ErrorTrackingList', () => { |
|
|
});
|
|
});
|
|
|
|
|
|
|
|
it('calls an action to remove the item from the list', () => {
|
|
it('calls an action to remove the item from the list', () => {
|
|
|
resolveErrorButton().trigger('click');
|
|
findErrorActions().vm.$emit('update-issue-status', { errorId: '1', status: undefined });
|
|
|
expect(actions.removeIgnoredResolvedErrors).toHaveBeenCalledWith(
|
|
expect(actions.removeIgnoredResolvedErrors).toHaveBeenCalledWith(
|
|
|
expect.anything(),
|
|
expect.anything(),
|
|
|
'1',
|
|
'1',
|
| ... | |
... | |
| ... | | ... | |