debian-mirror-gitlab/spec/frontend/integrations/edit/store/mutations_spec.js

86 lines
2.4 KiB
JavaScript
Raw Normal View History

2021-03-11 19:13:27 +05:30
import * as types from '~/integrations/edit/store/mutation_types';
2020-07-28 23:09:34 +05:30
import mutations from '~/integrations/edit/store/mutations';
import createState from '~/integrations/edit/store/state';
describe('Integration form store mutations', () => {
let state;
beforeEach(() => {
state = createState();
});
describe(`${types.SET_OVERRIDE}`, () => {
it('sets override', () => {
mutations[types.SET_OVERRIDE](state, true);
expect(state.override).toBe(true);
});
});
2021-01-29 00:20:46 +05:30
describe(`${types.SET_IS_SAVING}`, () => {
it('sets isSaving', () => {
mutations[types.SET_IS_SAVING](state, true);
expect(state.isSaving).toBe(true);
});
});
describe(`${types.SET_IS_TESTING}`, () => {
it('sets isTesting', () => {
mutations[types.SET_IS_TESTING](state, true);
expect(state.isTesting).toBe(true);
});
});
describe(`${types.SET_IS_RESETTING}`, () => {
it('sets isResetting', () => {
mutations[types.SET_IS_RESETTING](state, true);
expect(state.isResetting).toBe(true);
});
});
2021-02-22 17:27:13 +05:30
describe(`${types.REQUEST_RESET_INTEGRATION}`, () => {
it('sets isResetting', () => {
mutations[types.REQUEST_RESET_INTEGRATION](state);
expect(state.isResetting).toBe(true);
});
});
describe(`${types.RECEIVE_RESET_INTEGRATION_ERROR}`, () => {
it('sets isResetting', () => {
mutations[types.RECEIVE_RESET_INTEGRATION_ERROR](state);
expect(state.isResetting).toBe(false);
});
});
2021-03-11 19:13:27 +05:30
describe(`${types.SET_JIRA_ISSUE_TYPES}`, () => {
it('sets jiraIssueTypes', () => {
const jiraIssueTypes = ['issue', 'epic'];
mutations[types.SET_JIRA_ISSUE_TYPES](state, jiraIssueTypes);
expect(state.jiraIssueTypes).toBe(jiraIssueTypes);
});
});
describe(`${types.SET_IS_LOADING_JIRA_ISSUE_TYPES}`, () => {
it.each([true, false])('sets isLoadingJiraIssueTypes to "%s"', (isLoading) => {
mutations[types.SET_IS_LOADING_JIRA_ISSUE_TYPES](state, isLoading);
expect(state.isLoadingJiraIssueTypes).toBe(isLoading);
});
});
describe(`${types.SET_JIRA_ISSUE_TYPES_ERROR_MESSAGE}`, () => {
it('sets loadingJiraIssueTypesErrorMessage', () => {
const errorMessage = 'something went wrong';
mutations[types.SET_JIRA_ISSUE_TYPES_ERROR_MESSAGE](state, errorMessage);
expect(state.loadingJiraIssueTypesErrorMessage).toBe(errorMessage);
});
});
2020-07-28 23:09:34 +05:30
});