diff options
Diffstat (limited to 'spec/frontend/integrations/edit/store/actions_spec.js')
-rw-r--r-- | spec/frontend/integrations/edit/store/actions_spec.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/frontend/integrations/edit/store/actions_spec.js b/spec/frontend/integrations/edit/store/actions_spec.js index 1ff881c265d..4b7060fae55 100644 --- a/spec/frontend/integrations/edit/store/actions_spec.js +++ b/spec/frontend/integrations/edit/store/actions_spec.js @@ -9,6 +9,9 @@ import { requestResetIntegration, receiveResetIntegrationSuccess, receiveResetIntegrationError, + requestJiraIssueTypes, + receiveJiraIssueTypesSuccess, + receiveJiraIssueTypesError, } from '~/integrations/edit/store/actions'; import * as types from '~/integrations/edit/store/mutation_types'; @@ -70,4 +73,34 @@ describe('Integration form store actions', () => { ]); }); }); + + describe('requestJiraIssueTypes', () => { + it('should commit SET_JIRA_ISSUE_TYPES_ERROR_MESSAGE and SET_IS_LOADING_JIRA_ISSUE_TYPES mutations', () => { + return testAction(requestJiraIssueTypes, null, state, [ + { type: types.SET_JIRA_ISSUE_TYPES_ERROR_MESSAGE, payload: '' }, + { type: types.SET_IS_LOADING_JIRA_ISSUE_TYPES, payload: true }, + ]); + }); + }); + + describe('receiveJiraIssueTypesSuccess', () => { + it('should commit SET_IS_LOADING_JIRA_ISSUE_TYPES and SET_JIRA_ISSUE_TYPES mutations', () => { + const issueTypes = ['issue', 'epic']; + return testAction(receiveJiraIssueTypesSuccess, issueTypes, state, [ + { type: types.SET_IS_LOADING_JIRA_ISSUE_TYPES, payload: false }, + { type: types.SET_JIRA_ISSUE_TYPES, payload: issueTypes }, + ]); + }); + }); + + describe('receiveJiraIssueTypesError', () => { + it('should commit SET_IS_LOADING_JIRA_ISSUE_TYPES, SET_JIRA_ISSUE_TYPES and SET_JIRA_ISSUE_TYPES_ERROR_MESSAGE mutations', () => { + const errorMessage = 'something went wrong'; + return testAction(receiveJiraIssueTypesError, errorMessage, state, [ + { type: types.SET_IS_LOADING_JIRA_ISSUE_TYPES, payload: false }, + { type: types.SET_JIRA_ISSUE_TYPES, payload: [] }, + { type: types.SET_JIRA_ISSUE_TYPES_ERROR_MESSAGE, payload: errorMessage }, + ]); + }); + }); }); |