From d9e821dbd908f40ff9828357452cd55a651283fa Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Fri, 17 Jan 2020 03:09:17 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- .../components/error_tracking_list_spec.js | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'spec/frontend/error_tracking') 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 a747e07d70d..10b24cf04d3 100644 --- a/spec/frontend/error_tracking/components/error_tracking_list_spec.js +++ b/spec/frontend/error_tracking/components/error_tracking_list_spec.js @@ -31,6 +31,8 @@ describe('ErrorTrackingList', () => { store, propsData: { indexPath: '/path', + listPath: '/error_tracking', + projectPath: 'project/test', enableErrorTrackingLink: '/link', userCanEnableErrorTracking, errorTrackingEnabled, @@ -59,6 +61,7 @@ describe('ErrorTrackingList', () => { searchByQuery: jest.fn(), sortByField: jest.fn(), fetchPaginatedResults: jest.fn(), + updateStatus: jest.fn(), }; const state = { @@ -139,6 +142,14 @@ describe('ErrorTrackingList', () => { }); }); + it('each error in the list should have an ignore button', () => { + const error = wrapper.findAll('tbody tr'); + + error.wrappers.forEach((_, index) => { + expect(error.at(index).exists('glicon-stub[name="eye-slash"]')).toBe(true); + }); + }); + describe('filtering', () => { const findSearchBox = () => wrapper.find(GlFormInput); @@ -205,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 "ignored" 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({ -- cgit v1.2.3