diff options
Diffstat (limited to 'spec/frontend/error_tracking/components/error_tracking_list_spec.js')
-rw-r--r-- | spec/frontend/error_tracking/components/error_tracking_list_spec.js | 40 |
1 files changed, 40 insertions, 0 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 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({ |