diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-16 18:08:46 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-16 18:08:46 +0300 |
commit | 3940f59a61a749824aa4425ebdcaed6f3ed601f2 (patch) | |
tree | ebe2ffc65d0d7e7c6cd742e10c243d0cfbbb9e55 /spec/frontend/vuex_shared | |
parent | 3775eba7c1d41443461e3abcdab2867bbc4636ae (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/vuex_shared')
-rw-r--r-- | spec/frontend/vuex_shared/modules/members/actions_spec.js | 38 | ||||
-rw-r--r-- | spec/frontend/vuex_shared/modules/members/mutations_spec.js | 30 |
2 files changed, 65 insertions, 3 deletions
diff --git a/spec/frontend/vuex_shared/modules/members/actions_spec.js b/spec/frontend/vuex_shared/modules/members/actions_spec.js index aa04114d3e3..833bd4cc175 100644 --- a/spec/frontend/vuex_shared/modules/members/actions_spec.js +++ b/spec/frontend/vuex_shared/modules/members/actions_spec.js @@ -1,11 +1,15 @@ import { noop } from 'lodash'; import axios from 'axios'; import MockAdapter from 'axios-mock-adapter'; -import { members } from 'jest/vue_shared/components/members/mock_data'; +import { members, group } from 'jest/vue_shared/components/members/mock_data'; import testAction from 'helpers/vuex_action_helper'; import httpStatusCodes from '~/lib/utils/http_status'; import * as types from '~/vuex_shared/modules/members/mutation_types'; -import { updateMemberRole } from '~/vuex_shared/modules/members/actions'; +import { + updateMemberRole, + showRemoveGroupLinkModal, + hideRemoveGroupLinkModal, +} from '~/vuex_shared/modules/members/actions'; describe('Vuex members actions', () => { let mock; @@ -30,6 +34,8 @@ describe('Vuex members actions', () => { members, memberPath: '/groups/foo-bar/-/group_members/:id', requestFormatter: noop, + removeGroupLinkModalVisible: false, + groupLinkToRemove: null, }; describe('successful request', () => { @@ -73,4 +79,32 @@ describe('Vuex members actions', () => { }); }); }); + + describe('Group Link Modal', () => { + const state = { + removeGroupLinkModalVisible: false, + groupLinkToRemove: null, + }; + + describe('showRemoveGroupLinkModal', () => { + it(`commits ${types.SHOW_REMOVE_GROUP_LINK_MODAL} mutation`, () => { + testAction(showRemoveGroupLinkModal, group, state, [ + { + type: types.SHOW_REMOVE_GROUP_LINK_MODAL, + payload: group, + }, + ]); + }); + }); + + describe('hideRemoveGroupLinkModal', () => { + it(`commits ${types.HIDE_REMOVE_GROUP_LINK_MODAL} mutation`, () => { + testAction(hideRemoveGroupLinkModal, group, state, [ + { + type: types.HIDE_REMOVE_GROUP_LINK_MODAL, + }, + ]); + }); + }); + }); }); diff --git a/spec/frontend/vuex_shared/modules/members/mutations_spec.js b/spec/frontend/vuex_shared/modules/members/mutations_spec.js index 258af6a54ab..7338b19cfc9 100644 --- a/spec/frontend/vuex_shared/modules/members/mutations_spec.js +++ b/spec/frontend/vuex_shared/modules/members/mutations_spec.js @@ -1,4 +1,4 @@ -import { members } from 'jest/vue_shared/components/members/mock_data'; +import { members, group } from 'jest/vue_shared/components/members/mock_data'; import mutations from '~/vuex_shared/modules/members/mutations'; import * as types from '~/vuex_shared/modules/members/mutation_types'; @@ -59,4 +59,32 @@ describe('Vuex members mutations', () => { expect(state.errorMessage).toBe(''); }); }); + + describe(types.SHOW_REMOVE_GROUP_LINK_MODAL, () => { + it('sets `removeGroupLinkModalVisible` and `groupLinkToRemove`', () => { + const state = { + removeGroupLinkModalVisible: false, + groupLinkToRemove: null, + }; + + mutations[types.SHOW_REMOVE_GROUP_LINK_MODAL](state, group); + + expect(state).toEqual({ + removeGroupLinkModalVisible: true, + groupLinkToRemove: group, + }); + }); + }); + + describe(types.HIDE_REMOVE_GROUP_LINK_MODAL, () => { + it('sets `removeGroupLinkModalVisible` to `false`', () => { + const state = { + removeGroupLinkModalVisible: false, + }; + + mutations[types.HIDE_REMOVE_GROUP_LINK_MODAL](state); + + expect(state.removeGroupLinkModalVisible).toBe(false); + }); + }); }); |