diff options
author | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 13:34:23 -0600 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 13:34:23 -0600 |
commit | 6438df3a1e0fb944485cebf07976160184697d72 (patch) | |
tree | 00b09bfd170e77ae9391b1a2f5a93ef6839f2597 /spec/frontend/reports/store | |
parent | 42bcd54d971da7ef2854b896a7b34f4ef8601067 (diff) | |
download | gitlab-ce-6438df3a1e0fb944485cebf07976160184697d72.tar.gz |
Add latest changes from gitlab-org/gitlab@13-8-stable-eev13.8.0-rc42
Diffstat (limited to 'spec/frontend/reports/store')
-rw-r--r-- | spec/frontend/reports/store/actions_spec.js | 30 | ||||
-rw-r--r-- | spec/frontend/reports/store/mutations_spec.js | 27 |
2 files changed, 42 insertions, 15 deletions
diff --git a/spec/frontend/reports/store/actions_spec.js b/spec/frontend/reports/store/actions_spec.js index 3f189736922..b7c4a31b1c8 100644 --- a/spec/frontend/reports/store/actions_spec.js +++ b/spec/frontend/reports/store/actions_spec.js @@ -11,7 +11,7 @@ import { receiveReportsSuccess, receiveReportsError, openModal, - setModalData, + closeModal, } from '~/reports/store/actions'; import state from '~/reports/store/state'; import * as types from '~/reports/store/mutation_types'; @@ -24,7 +24,7 @@ describe('Reports Store Actions', () => { }); describe('setEndpoint', () => { - it('should commit SET_ENDPOINT mutation', done => { + it('should commit SET_ENDPOINT mutation', (done) => { testAction( setEndpoint, 'endpoint.json', @@ -37,7 +37,7 @@ describe('Reports Store Actions', () => { }); describe('requestReports', () => { - it('should commit REQUEST_REPORTS mutation', done => { + it('should commit REQUEST_REPORTS mutation', (done) => { testAction(requestReports, null, mockedState, [{ type: types.REQUEST_REPORTS }], [], done); }); }); @@ -57,7 +57,7 @@ describe('Reports Store Actions', () => { }); describe('success', () => { - it('dispatches requestReports and receiveReportsSuccess ', done => { + it('dispatches requestReports and receiveReportsSuccess ', (done) => { mock .onGet(`${TEST_HOST}/endpoint.json`) .replyOnce(200, { summary: {}, suites: [{ name: 'rspec' }] }); @@ -86,7 +86,7 @@ describe('Reports Store Actions', () => { mock.onGet(`${TEST_HOST}/endpoint.json`).reply(500); }); - it('dispatches requestReports and receiveReportsError ', done => { + it('dispatches requestReports and receiveReportsError ', (done) => { testAction( fetchReports, null, @@ -107,7 +107,7 @@ describe('Reports Store Actions', () => { }); describe('receiveReportsSuccess', () => { - it('should commit RECEIVE_REPORTS_SUCCESS mutation with 200', done => { + it('should commit RECEIVE_REPORTS_SUCCESS mutation with 200', (done) => { testAction( receiveReportsSuccess, { data: { summary: {} }, status: 200 }, @@ -118,7 +118,7 @@ describe('Reports Store Actions', () => { ); }); - it('should not commit RECEIVE_REPORTS_SUCCESS mutation with 204', done => { + it('should not commit RECEIVE_REPORTS_SUCCESS mutation with 204', (done) => { testAction( receiveReportsSuccess, { data: { summary: {} }, status: 204 }, @@ -131,7 +131,7 @@ describe('Reports Store Actions', () => { }); describe('receiveReportsError', () => { - it('should commit RECEIVE_REPORTS_ERROR mutation', done => { + it('should commit RECEIVE_REPORTS_ERROR mutation', (done) => { testAction( receiveReportsError, null, @@ -144,25 +144,25 @@ describe('Reports Store Actions', () => { }); describe('openModal', () => { - it('should dispatch setModalData', done => { + it('should commit SET_ISSUE_MODAL_DATA', (done) => { testAction( openModal, { name: 'foo' }, mockedState, + [{ type: types.SET_ISSUE_MODAL_DATA, payload: { name: 'foo' } }], [], - [{ type: 'setModalData', payload: { name: 'foo' } }], done, ); }); }); - describe('setModalData', () => { - it('should commit SET_ISSUE_MODAL_DATA', done => { + describe('closeModal', () => { + it('should commit RESET_ISSUE_MODAL_DATA', (done) => { testAction( - setModalData, - { name: 'foo' }, + closeModal, + {}, mockedState, - [{ type: types.SET_ISSUE_MODAL_DATA, payload: { name: 'foo' } }], + [{ type: types.RESET_ISSUE_MODAL_DATA, payload: {} }], [], done, ); diff --git a/spec/frontend/reports/store/mutations_spec.js b/spec/frontend/reports/store/mutations_spec.js index c1c5862a37c..59065d1151f 100644 --- a/spec/frontend/reports/store/mutations_spec.js +++ b/spec/frontend/reports/store/mutations_spec.js @@ -127,5 +127,32 @@ describe('Reports Store Mutations', () => { expect(stateCopy.modal.data.execution_time.value).toEqual(issue.execution_time); expect(stateCopy.modal.data.system_output.value).toEqual(issue.system_output); }); + + it('should open modal', () => { + expect(stateCopy.modal.open).toEqual(true); + }); + }); + + describe('RESET_ISSUE_MODAL_DATA', () => { + beforeEach(() => { + mutations[types.SET_ISSUE_MODAL_DATA](stateCopy, { + issue, + }); + + mutations[types.RESET_ISSUE_MODAL_DATA](stateCopy); + }); + + it('should reset modal title', () => { + expect(stateCopy.modal.title).toEqual(null); + }); + + it('should reset modal data', () => { + expect(stateCopy.modal.data.execution_time.value).toEqual(null); + expect(stateCopy.modal.data.system_output.value).toEqual(null); + }); + + it('should close modal', () => { + expect(stateCopy.modal.open).toEqual(false); + }); }); }); |