Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-10 12:08:56 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-10 12:08:56 +0300
commitb4ded0ba7b4d2cdbed5b1f331cf2083a25ee4d7c (patch)
tree6694fa9d8f3e226597cc01dfb8e3e07b50ae85b6 /spec/frontend/error_tracking
parent2aaef94c80937d9d188f7b9cbbad2dcd1508c3c1 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/error_tracking')
-rw-r--r--spec/frontend/error_tracking/components/error_tracking_list_spec.js29
-rw-r--r--spec/frontend/error_tracking/store/list/mutation_spec.js25
2 files changed, 50 insertions, 4 deletions
diff --git a/spec/frontend/error_tracking/components/error_tracking_list_spec.js b/spec/frontend/error_tracking/components/error_tracking_list_spec.js
index 9cf73d54d9b..b632b461eb9 100644
--- a/spec/frontend/error_tracking/components/error_tracking_list_spec.js
+++ b/spec/frontend/error_tracking/components/error_tracking_list_spec.js
@@ -62,6 +62,7 @@ describe('ErrorTrackingList', () => {
sortByField: jest.fn(),
fetchPaginatedResults: jest.fn(),
updateStatus: jest.fn(),
+ removeIgnoredResolvedErrors: jest.fn(),
};
const state = {
@@ -221,6 +222,8 @@ describe('ErrorTrackingList', () => {
});
describe('When the ignore button on an error is clicked', () => {
+ const ignoreErrorButton = () => wrapper.find({ ref: 'ignoreError' });
+
beforeEach(() => {
store.state.list.loading = false;
store.state.list.errors = errorsList;
@@ -235,20 +238,30 @@ describe('ErrorTrackingList', () => {
});
it('sends the "ignored" status and error ID', () => {
- wrapper.find({ ref: 'ignoreError' }).trigger('click');
+ ignoreErrorButton().trigger('click');
expect(actions.updateStatus).toHaveBeenCalledWith(
expect.anything(),
{
endpoint: `/project/test/-/error_tracking/${errorsList[0].id}.json`,
- redirectUrl: '/error_tracking',
status: 'ignored',
},
undefined,
);
});
+
+ it('calls an action to remove the item from the list', () => {
+ ignoreErrorButton().trigger('click');
+ expect(actions.removeIgnoredResolvedErrors).toHaveBeenCalledWith(
+ expect.anything(),
+ '1',
+ undefined,
+ );
+ });
});
describe('When the resolve button on an error is clicked', () => {
+ const resolveErrorButton = () => wrapper.find({ ref: 'resolveError' });
+
beforeEach(() => {
store.state.list.loading = false;
store.state.list.errors = errorsList;
@@ -263,17 +276,25 @@ describe('ErrorTrackingList', () => {
});
it('sends "resolved" status and error ID', () => {
- wrapper.find({ ref: 'resolveError' }).trigger('click');
+ resolveErrorButton().trigger('click');
expect(actions.updateStatus).toHaveBeenCalledWith(
expect.anything(),
{
endpoint: `/project/test/-/error_tracking/${errorsList[0].id}.json`,
- redirectUrl: '/error_tracking',
status: 'resolved',
},
undefined,
);
});
+
+ it('calls an action to remove the item from the list', () => {
+ resolveErrorButton().trigger('click');
+ expect(actions.removeIgnoredResolvedErrors).toHaveBeenCalledWith(
+ expect.anything(),
+ '1',
+ undefined,
+ );
+ });
});
describe('When error tracking is disabled and user is not allowed to enable it', () => {
diff --git a/spec/frontend/error_tracking/store/list/mutation_spec.js b/spec/frontend/error_tracking/store/list/mutation_spec.js
index 44a75b6aa1f..65f11aeeda1 100644
--- a/spec/frontend/error_tracking/store/list/mutation_spec.js
+++ b/spec/frontend/error_tracking/store/list/mutation_spec.js
@@ -5,6 +5,7 @@ import * as types from '~/error_tracking/store/list/mutation_types';
const ADD_RECENT_SEARCH = mutations[types.ADD_RECENT_SEARCH];
const CLEAR_RECENT_SEARCHES = mutations[types.CLEAR_RECENT_SEARCHES];
const LOAD_RECENT_SEARCHES = mutations[types.LOAD_RECENT_SEARCHES];
+const REMOVE_IGNORED_RESOLVED_ERRORS = mutations[types.REMOVE_IGNORED_RESOLVED_ERRORS];
describe('Error tracking mutations', () => {
describe('SET_ERRORS', () => {
@@ -114,5 +115,29 @@ describe('Error tracking mutations', () => {
expect(localStorage.getItem).toHaveBeenCalledWith('recent-searches/project/errors.json');
});
});
+
+ describe('REMOVE_IGNORED_RESOLVED_ERRORS', () => {
+ it('removes ignored or resolved errors from list', () => {
+ state.errors = [
+ {
+ id: 1,
+ status: 'unresolved',
+ },
+ {
+ id: 2,
+ status: 'ignored',
+ },
+ {
+ id: 3,
+ status: 'unresolved',
+ },
+ ];
+ const ignoredError = state.errors[2].id;
+
+ REMOVE_IGNORED_RESOLVED_ERRORS(state, ignoredError);
+
+ expect(state.errors).not.toContain(ignoredError);
+ });
+ });
});
});