From 691ff9be4cb45252df3da9fdbd44551f48fc3af6 Mon Sep 17 00:00:00 2001 From: Ammar Alakkad <am.alakkad@gmail.com> Date: Tue, 28 May 2024 12:02:20 +0300 Subject: [PATCH] Rename MEMBER_TYPES to MEMBERS_TAB_TYPES This is needed since not all tabs in the members page are actually members, but it could include other things related to members like banned or promotion requests. --- .../members/components/members_tabs.vue | 6 +++--- .../components/table/member_actions.vue | 10 +++++----- .../components/table/members_table_cell.vue | 10 +++++----- app/assets/javascripts/members/constants.js | 2 +- .../javascripts/members/tabs_metadata.js | 12 ++++++------ .../pages/groups/group_members/index.js | 10 +++++----- .../pages/projects/project_members/index.js | 10 +++++----- .../components/table/members_table_cell.vue | 6 +++--- ee/app/assets/javascripts/members/constants.js | 12 ++++++------ .../javascripts/members/tabs_metadata.js | 6 +++--- .../banned_action_buttons_spec.js | 6 +++--- .../ban_member_dropdown_item_spec.js | 6 +++--- .../disable_two_factor_dropdown_item_spec.js | 6 +++--- .../ldap_dropdown_item_spec.js | 6 +++--- .../ldap_override_dropdown_item_spec.js | 6 +++--- .../user_action_dropdown_spec.js | 4 ++-- .../members_filtered_search_bar_spec.js | 6 +++--- .../members/components/members_tabs_spec.js | 16 +++++++++------- .../modals/disable_two_factor_modal_spec.js | 6 +++--- .../ldap_override_confirmation_modal_spec.js | 6 +++--- .../table/expiration_datepicker_spec.js | 4 ++-- .../members/components/table/max_role_spec.js | 6 +++--- .../table/member_action_buttons_spec.js | 14 +++++++------- .../components/table/member_avatar_spec.js | 4 ++-- .../table/members_table_cell_spec.js | 16 ++++++++-------- .../components/table/members_table_spec.js | 6 +++--- ee/spec/frontend/members/index_spec.js | 12 ++++++------ ee/spec/frontend/members/mock_data.js | 4 ++-- .../promotion_requests/components/app_spec.js | 6 +++--- .../approve_access_request_button_spec.js | 6 +++--- .../remove_group_link_button_spec.js | 6 +++--- .../remove_member_button_spec.js | 6 +++--- .../resend_invite_button_spec.js | 6 +++--- .../remove_member_dropdown_item_spec.js | 6 +++--- spec/frontend/members/components/app_spec.js | 10 +++++----- .../filter_sort/filter_sort_container_spec.js | 6 +++--- .../members_filtered_search_bar_spec.js | 6 +++--- .../filter_sort/sort_dropdown_spec.js | 6 +++--- .../members/components/members_tabs_spec.js | 18 +++++++++--------- .../components/modals/leave_modal_spec.js | 6 +++--- .../modals/remove_group_link_modal_spec.js | 6 +++--- .../modals/remove_member_modal_spec.js | 6 +++--- .../table/expiration_datepicker_spec.js | 6 +++--- .../members/components/table/max_role_spec.js | 6 +++--- .../table/member_action_buttons_spec.js | 12 ++++++------ .../components/table/member_avatar_spec.js | 12 ++++++------ .../table/members_table_cell_spec.js | 10 +++++----- .../components/table/members_table_spec.js | 6 +++--- spec/frontend/members/index_spec.js | 8 ++++---- spec/frontend/members/mock_data.js | 4 ++-- spec/frontend/members/utils_spec.js | 4 ++-- 51 files changed, 194 insertions(+), 192 deletions(-) diff --git a/app/assets/javascripts/members/components/members_tabs.vue b/app/assets/javascripts/members/components/members_tabs.vue index 134edfac8e38c..05fde6369d167 100644 --- a/app/assets/javascripts/members/components/members_tabs.vue +++ b/app/assets/javascripts/members/components/members_tabs.vue @@ -3,7 +3,7 @@ import { GlTabs, GlTab, GlBadge, GlButton } from '@gitlab/ui'; // eslint-disable-next-line no-restricted-imports import { mapState } from 'vuex'; import { queryToObject } from '~/lib/utils/url_utility'; -import { MEMBER_TYPES, ACTIVE_TAB_QUERY_PARAM_NAME } from 'ee_else_ce/members/constants'; +import { MEMBERS_TAB_TYPES, ACTIVE_TAB_QUERY_PARAM_NAME } from 'ee_else_ce/members/constants'; import { TABS } from 'ee_else_ce/members/tabs_metadata'; import MembersApp from './app.vue'; @@ -22,7 +22,7 @@ export default { }, computed: { ...mapState( - Object.values(MEMBER_TYPES).reduce((getters, memberType) => { + Object.values(MEMBERS_TAB_TYPES).reduce((getters, memberType) => { return { ...getters, // eslint-disable-next-line @gitlab/require-i18n-strings @@ -68,7 +68,7 @@ export default { return this[`${namespace}Count`]; }, showTab(tab, index) { - if (tab.namespace === MEMBER_TYPES.user) { + if (tab.namespace === MEMBERS_TAB_TYPES.user) { return true; } diff --git a/app/assets/javascripts/members/components/table/member_actions.vue b/app/assets/javascripts/members/components/table/member_actions.vue index beb5fe3b7c4ee..d71f5eacf69c5 100644 --- a/app/assets/javascripts/members/components/table/member_actions.vue +++ b/app/assets/javascripts/members/components/table/member_actions.vue @@ -1,5 +1,5 @@ <script> -import { MEMBER_TYPES, ACTION_BUTTONS } from 'ee_else_ce/members/constants'; +import { MEMBERS_TAB_TYPES, ACTION_BUTTONS } from 'ee_else_ce/members/constants'; import AccessRequestActionButtons from '../action_buttons/access_request_action_buttons.vue'; import GroupActionButtons from '../action_buttons/group_action_buttons.vue'; import InviteActionButtons from '../action_buttons/invite_action_buttons.vue'; @@ -36,10 +36,10 @@ export default { computed: { actionButtonComponent() { const dictionary = { - [MEMBER_TYPES.user]: 'user-action-dropdown', - [MEMBER_TYPES.group]: 'group-action-buttons', - [MEMBER_TYPES.invite]: 'invite-action-buttons', - [MEMBER_TYPES.accessRequest]: 'access-request-action-buttons', + [MEMBERS_TAB_TYPES.user]: 'user-action-dropdown', + [MEMBERS_TAB_TYPES.group]: 'group-action-buttons', + [MEMBERS_TAB_TYPES.invite]: 'invite-action-buttons', + [MEMBERS_TAB_TYPES.accessRequest]: 'access-request-action-buttons', ...ACTION_BUTTONS, }; diff --git a/app/assets/javascripts/members/components/table/members_table_cell.vue b/app/assets/javascripts/members/components/table/members_table_cell.vue index cac8c9fb4db06..5bbd98278b7ee 100644 --- a/app/assets/javascripts/members/components/table/members_table_cell.vue +++ b/app/assets/javascripts/members/components/table/members_table_cell.vue @@ -1,5 +1,5 @@ <script> -import { MEMBER_TYPES } from 'ee_else_ce/members/constants'; +import { MEMBERS_TAB_TYPES } from 'ee_else_ce/members/constants'; import { isGroup, isDirectMember, @@ -31,16 +31,16 @@ export default { }, memberType() { if (this.isGroup) { - return MEMBER_TYPES.group; + return MEMBERS_TAB_TYPES.group; } if (this.isInvite) { - return MEMBER_TYPES.invite; + return MEMBERS_TAB_TYPES.invite; } if (this.isAccessRequest) { - return MEMBER_TYPES.accessRequest; + return MEMBERS_TAB_TYPES.accessRequest; } - return MEMBER_TYPES.user; + return MEMBERS_TAB_TYPES.user; }, isDirectMember() { return isDirectMember(this.member); diff --git a/app/assets/javascripts/members/constants.js b/app/assets/javascripts/members/constants.js index 593b5ed979918..f35b06ca8eb5f 100644 --- a/app/assets/javascripts/members/constants.js +++ b/app/assets/javascripts/members/constants.js @@ -161,7 +161,7 @@ export const AVAILABLE_FILTERED_SEARCH_TOKENS = [ export const AVATAR_SIZE = 48; -export const MEMBER_TYPES = Object.freeze({ +export const MEMBERS_TAB_TYPES = Object.freeze({ user: 'user', group: 'group', invite: 'invite', diff --git a/app/assets/javascripts/members/tabs_metadata.js b/app/assets/javascripts/members/tabs_metadata.js index 0ef7cbf3da86b..cfc76a3925817 100644 --- a/app/assets/javascripts/members/tabs_metadata.js +++ b/app/assets/javascripts/members/tabs_metadata.js @@ -1,33 +1,33 @@ import { __, s__ } from '~/locale'; import PlaceholdersTabApp from './components/placeholders/app.vue'; -import { MEMBER_TYPES, TAB_QUERY_PARAM_VALUES } from './constants'; +import { MEMBERS_TAB_TYPES, TAB_QUERY_PARAM_VALUES } from './constants'; // Overridden in EE export const TABS = [ { - namespace: MEMBER_TYPES.user, + namespace: MEMBERS_TAB_TYPES.user, title: __('Members'), }, { - namespace: MEMBER_TYPES.group, + namespace: MEMBERS_TAB_TYPES.group, title: __('Groups'), attrs: { 'data-testid': 'groups-list-tab' }, queryParamValue: TAB_QUERY_PARAM_VALUES.group, }, { - namespace: MEMBER_TYPES.invite, + namespace: MEMBERS_TAB_TYPES.invite, title: s__('Members|Pending invitations'), requiredPermissions: ['canManageMembers'], queryParamValue: TAB_QUERY_PARAM_VALUES.invite, }, { - namespace: MEMBER_TYPES.accessRequest, + namespace: MEMBERS_TAB_TYPES.accessRequest, title: __('Access requests'), requiredPermissions: ['canManageAccessRequests'], queryParamValue: TAB_QUERY_PARAM_VALUES.accessRequest, }, { - namespace: MEMBER_TYPES.placeholder, + namespace: MEMBERS_TAB_TYPES.placeholder, title: s__('UserMapping|Placeholders'), queryParamValue: TAB_QUERY_PARAM_VALUES.placeholder, component: PlaceholdersTabApp, diff --git a/app/assets/javascripts/pages/groups/group_members/index.js b/app/assets/javascripts/pages/groups/group_members/index.js index 014ae933ac960..2717098650e21 100644 --- a/app/assets/javascripts/pages/groups/group_members/index.js +++ b/app/assets/javascripts/pages/groups/group_members/index.js @@ -3,12 +3,12 @@ import initInviteGroupTrigger from '~/invite_members/init_invite_group_trigger'; import initInviteGroupsModal from '~/invite_members/init_invite_groups_modal'; import { s__ } from '~/locale'; import { initMembersApp } from '~/members'; -import { EE_GROUPS_APP_OPTIONS, MEMBER_TYPES } from 'ee_else_ce/members/constants'; +import { EE_GROUPS_APP_OPTIONS, MEMBERS_TAB_TYPES } from 'ee_else_ce/members/constants'; import { groupLinkRequestFormatter } from '~/members/utils'; const SHARED_FIELDS = ['account', 'maxRole', 'expiration', 'actions']; const APP_OPTIONS = { - [MEMBER_TYPES.user]: { + [MEMBERS_TAB_TYPES.user]: { tableFields: SHARED_FIELDS.concat(['source', 'activity']), tableSortableFields: [ 'account', @@ -27,7 +27,7 @@ const APP_OPTIONS = { recentSearchesStorageKey: 'group_members', }, }, - [MEMBER_TYPES.group]: { + [MEMBERS_TAB_TYPES.group]: { tableFields: SHARED_FIELDS.concat(['source', 'granted']), requestFormatter: groupLinkRequestFormatter, filteredSearchBar: { @@ -38,7 +38,7 @@ const APP_OPTIONS = { recentSearchesStorageKey: 'group_links_members', }, }, - [MEMBER_TYPES.invite]: { + [MEMBERS_TAB_TYPES.invite]: { tableFields: SHARED_FIELDS.concat('invited'), requestFormatter: groupMemberRequestFormatter, filteredSearchBar: { @@ -49,7 +49,7 @@ const APP_OPTIONS = { recentSearchesStorageKey: 'group_invited_members', }, }, - [MEMBER_TYPES.accessRequest]: { + [MEMBERS_TAB_TYPES.accessRequest]: { tableFields: SHARED_FIELDS.concat('requested'), requestFormatter: groupMemberRequestFormatter, }, diff --git a/app/assets/javascripts/pages/projects/project_members/index.js b/app/assets/javascripts/pages/projects/project_members/index.js index 17f41e03715b9..116a5e4c32251 100644 --- a/app/assets/javascripts/pages/projects/project_members/index.js +++ b/app/assets/javascripts/pages/projects/project_members/index.js @@ -1,4 +1,4 @@ -import { EE_PROJECTS_APP_OPTIONS, MEMBER_TYPES } from 'ee_else_ce/members/constants'; +import { EE_PROJECTS_APP_OPTIONS, MEMBERS_TAB_TYPES } from 'ee_else_ce/members/constants'; import initImportProjectMembersTrigger from '~/invite_members/init_import_project_members_trigger'; import initImportProjectMembersModal from '~/invite_members/init_import_project_members_modal'; import initInviteGroupTrigger from '~/invite_members/init_invite_group_trigger'; @@ -15,7 +15,7 @@ initImportProjectMembersTrigger(); const SHARED_FIELDS = ['account', 'maxRole', 'expiration', 'actions']; initMembersApp(document.querySelector('.js-project-members-list-app'), { - [MEMBER_TYPES.user]: { + [MEMBERS_TAB_TYPES.user]: { tableFields: SHARED_FIELDS.concat(['source', 'activity']), tableSortableFields: [ 'account', @@ -34,7 +34,7 @@ initMembersApp(document.querySelector('.js-project-members-list-app'), { recentSearchesStorageKey: 'project_members', }, }, - [MEMBER_TYPES.group]: { + [MEMBERS_TAB_TYPES.group]: { tableFields: SHARED_FIELDS.concat(['source', 'granted']), requestFormatter: groupLinkRequestFormatter, filteredSearchBar: { @@ -45,11 +45,11 @@ initMembersApp(document.querySelector('.js-project-members-list-app'), { recentSearchesStorageKey: 'project_group_links', }, }, - [MEMBER_TYPES.invite]: { + [MEMBERS_TAB_TYPES.invite]: { tableFields: SHARED_FIELDS.concat('invited'), requestFormatter: projectMemberRequestFormatter, }, - [MEMBER_TYPES.accessRequest]: { + [MEMBERS_TAB_TYPES.accessRequest]: { tableFields: SHARED_FIELDS.concat('requested'), requestFormatter: projectMemberRequestFormatter, }, diff --git a/ee/app/assets/javascripts/members/components/table/members_table_cell.vue b/ee/app/assets/javascripts/members/components/table/members_table_cell.vue index 93c52409c8902..1e6b5fa54d5c3 100644 --- a/ee/app/assets/javascripts/members/components/table/members_table_cell.vue +++ b/ee/app/assets/javascripts/members/components/table/members_table_cell.vue @@ -1,6 +1,6 @@ <script> import CEMembersTableCell from '~/members/components/table/members_table_cell.vue'; -import { MEMBER_TYPES } from 'ee_else_ce/members/constants'; +import { MEMBERS_TAB_TYPES } from 'ee_else_ce/members/constants'; import { canDisableTwoFactor, canOverride, canUnban } from '../../utils'; export default { @@ -25,8 +25,8 @@ export default { }, methods: { memberType(ceMemberType) { - if (this.namespace === MEMBER_TYPES.banned && this.member.banned) { - return MEMBER_TYPES.banned; + if (this.namespace === MEMBERS_TAB_TYPES.banned && this.member.banned) { + return MEMBERS_TAB_TYPES.banned; } return ceMemberType; diff --git a/ee/app/assets/javascripts/members/constants.js b/ee/app/assets/javascripts/members/constants.js index 7e3c4f7285eb6..bb10c16a2124d 100644 --- a/ee/app/assets/javascripts/members/constants.js +++ b/ee/app/assets/javascripts/members/constants.js @@ -5,7 +5,7 @@ import { __, n__, s__, sprintf } from '~/locale'; import { OPERATORS_IS } from '~/vue_shared/components/filtered_search_bar/constants'; import { AVAILABLE_FILTERED_SEARCH_TOKENS as AVAILABLE_FILTERED_SEARCH_TOKENS_CE, - MEMBER_TYPES as MEMBER_TYPES_CE, + MEMBERS_TAB_TYPES as MEMBERS_TAB_TYPES_CE, TAB_QUERY_PARAM_VALUES as CE_TAB_QUERY_PARAM_VALUES, } from '~/members/constants'; import { helpPagePath } from '~/helpers/help_page_helper'; @@ -55,15 +55,15 @@ export const AVAILABLE_FILTERED_SEARCH_TOKENS = [ ]; // eslint-disable-next-line import/export -export const MEMBER_TYPES = Object.freeze({ - ...MEMBER_TYPES_CE, +export const MEMBERS_TAB_TYPES = Object.freeze({ + ...MEMBERS_TAB_TYPES_CE, promotionRequest: 'promotionRequest', banned: 'banned', }); // eslint-disable-next-line import/export export const ACTION_BUTTONS = { - [MEMBER_TYPES.banned]: 'banned-action-buttons', + [MEMBERS_TAB_TYPES.banned]: 'banned-action-buttons', }; // eslint-disable-next-line import/export @@ -74,7 +74,7 @@ export const TAB_QUERY_PARAM_VALUES = Object.freeze({ }); const APP_OPTIONS_BASE = { - [MEMBER_TYPES.promotionRequest]: gon.features?.memberPromotionManagement, + [MEMBERS_TAB_TYPES.promotionRequest]: gon.features?.memberPromotionManagement, }; const uniqueProjectDownloadLimitEnabled = @@ -85,7 +85,7 @@ const uniqueProjectDownloadLimitEnabled = export const EE_GROUPS_APP_OPTIONS = uniqueProjectDownloadLimitEnabled ? { ...APP_OPTIONS_BASE, - [MEMBER_TYPES.banned]: { + [MEMBERS_TAB_TYPES.banned]: { tableFields: ['account', 'actions'], requestFormatter: groupMemberRequestFormatter, }, diff --git a/ee/app/assets/javascripts/members/tabs_metadata.js b/ee/app/assets/javascripts/members/tabs_metadata.js index 021764ad74dce..1837be5c536a6 100644 --- a/ee/app/assets/javascripts/members/tabs_metadata.js +++ b/ee/app/assets/javascripts/members/tabs_metadata.js @@ -2,12 +2,12 @@ import { __ } from '~/locale'; import { TABS as CE_TABS } from '~/members/tabs_metadata'; import PromotionRequestsTabApp from './promotion_requests/components/app.vue'; import promotionRequestsTabStore from './promotion_requests/store/index'; -import { MEMBER_TYPES, TAB_QUERY_PARAM_VALUES } from './constants'; +import { MEMBERS_TAB_TYPES, TAB_QUERY_PARAM_VALUES } from './constants'; export const TABS = [ ...CE_TABS, { - namespace: MEMBER_TYPES.promotionRequest, + namespace: MEMBERS_TAB_TYPES.promotionRequest, title: __('Promotions'), queryParamValue: TAB_QUERY_PARAM_VALUES.promotionRequest, component: PromotionRequestsTabApp, @@ -15,7 +15,7 @@ export const TABS = [ hideExportButton: true, }, { - namespace: MEMBER_TYPES.banned, + namespace: MEMBERS_TAB_TYPES.banned, title: __('Banned'), queryParamValue: TAB_QUERY_PARAM_VALUES.banned, }, diff --git a/ee/spec/frontend/members/components/action_buttons/banned_action_buttons_spec.js b/ee/spec/frontend/members/components/action_buttons/banned_action_buttons_spec.js index 4f178d95a4986..7f683cfb3b8ff 100644 --- a/ee/spec/frontend/members/components/action_buttons/banned_action_buttons_spec.js +++ b/ee/spec/frontend/members/components/action_buttons/banned_action_buttons_spec.js @@ -4,7 +4,7 @@ import Vue from 'vue'; // eslint-disable-next-line no-restricted-imports import Vuex from 'vuex'; import BannedActionButtons from 'ee/members/components/action_buttons/banned_action_buttons.vue'; -import { MEMBER_TYPES } from '~/members/constants'; +import { MEMBERS_TAB_TYPES } from '~/members/constants'; import { assertProps } from 'helpers/assert_props'; import { bannedMember as member } from '../../mock_data'; @@ -22,7 +22,7 @@ describe('BannedActionButtons', () => { const createStore = (state = {}) => { return new Vuex.Store({ modules: { - [MEMBER_TYPES.banned]: { + [MEMBERS_TAB_TYPES.banned]: { namespaced: true, state: { memberPath: `${DEFAULT_MEMBERS_PATH}/:id`, @@ -37,7 +37,7 @@ describe('BannedActionButtons', () => { wrapper = shallowMount(BannedActionButtons, { store: createStore(), provide: { - namespace: MEMBER_TYPES.banned, + namespace: MEMBERS_TAB_TYPES.banned, }, propsData: { ...defaultProps, diff --git a/ee/spec/frontend/members/components/action_dropdowns/ban_member_dropdown_item_spec.js b/ee/spec/frontend/members/components/action_dropdowns/ban_member_dropdown_item_spec.js index ee2f0cecfa0a5..6a1b3f9ed253a 100644 --- a/ee/spec/frontend/members/components/action_dropdowns/ban_member_dropdown_item_spec.js +++ b/ee/spec/frontend/members/components/action_dropdowns/ban_member_dropdown_item_spec.js @@ -5,7 +5,7 @@ import Vue from 'vue'; import Vuex from 'vuex'; import BanMemberDropdownItem from 'ee/members/components/action_dropdowns/ban_member_dropdown_item.vue'; import { member } from 'jest/members/mock_data'; -import { MEMBER_TYPES } from '~/members/constants'; +import { MEMBERS_TAB_TYPES } from '~/members/constants'; jest.mock('~/lib/utils/csrf', () => ({ token: 'mock-csrf-token' })); @@ -19,7 +19,7 @@ describe('BanMemberDropdownItem', () => { const createStore = () => { return new Vuex.Store({ modules: { - [MEMBER_TYPES.user]: { + [MEMBERS_TAB_TYPES.user]: { namespaced: true, state: { memberPath: `${DEFAULT_MEMBERS_PATH}/:id` }, }, @@ -30,7 +30,7 @@ describe('BanMemberDropdownItem', () => { const createComponent = () => { wrapper = shallowMount(BanMemberDropdownItem, { store: createStore(), - provide: { namespace: MEMBER_TYPES.user }, + provide: { namespace: MEMBERS_TAB_TYPES.user }, slots: { default: 'Dropdown item text' }, propsData: { member }, }); diff --git a/ee/spec/frontend/members/components/action_dropdowns/disable_two_factor_dropdown_item_spec.js b/ee/spec/frontend/members/components/action_dropdowns/disable_two_factor_dropdown_item_spec.js index a1c81baf929dc..44b2c1c3ad98f 100644 --- a/ee/spec/frontend/members/components/action_dropdowns/disable_two_factor_dropdown_item_spec.js +++ b/ee/spec/frontend/members/components/action_dropdowns/disable_two_factor_dropdown_item_spec.js @@ -4,7 +4,7 @@ import Vue from 'vue'; // eslint-disable-next-line no-restricted-imports import Vuex from 'vuex'; import DisableTwoFactorDropdownItem from 'ee/members/components/action_dropdowns/disable_two_factor_dropdown_item.vue'; -import { MEMBER_TYPES } from '~/members/constants'; +import { MEMBERS_TAB_TYPES } from '~/members/constants'; Vue.use(Vuex); @@ -21,7 +21,7 @@ describe('DisableTwoFactorDropdownItem', () => { const createStore = (state = {}) => { return new Vuex.Store({ modules: { - [MEMBER_TYPES.user]: { + [MEMBERS_TAB_TYPES.user]: { namespaced: true, state: { memberPath: '/groups/foo-bar/-/group_members/:id', @@ -37,7 +37,7 @@ describe('DisableTwoFactorDropdownItem', () => { wrapper = shallowMount(DisableTwoFactorDropdownItem, { store: createStore(state), provide: { - namespace: MEMBER_TYPES.user, + namespace: MEMBERS_TAB_TYPES.user, }, propsData: { modalMessage, diff --git a/ee/spec/frontend/members/components/action_dropdowns/ldap_dropdown_item_spec.js b/ee/spec/frontend/members/components/action_dropdowns/ldap_dropdown_item_spec.js index c46cc45844124..8d70a4268758c 100644 --- a/ee/spec/frontend/members/components/action_dropdowns/ldap_dropdown_item_spec.js +++ b/ee/spec/frontend/members/components/action_dropdowns/ldap_dropdown_item_spec.js @@ -5,7 +5,7 @@ import Vue from 'vue'; import Vuex from 'vuex'; import LdapDropdownFooter from 'ee/members/components/action_dropdowns/ldap_dropdown_footer.vue'; import waitForPromises from 'helpers/wait_for_promises'; -import { MEMBER_TYPES } from '~/members/constants'; +import { MEMBERS_TAB_TYPES } from '~/members/constants'; Vue.use(Vuex); @@ -23,7 +23,7 @@ describe('LdapDropdownFooter', () => { return new Vuex.Store({ modules: { - [MEMBER_TYPES.user]: { + [MEMBERS_TAB_TYPES.user]: { namespaced: true, actions, }, @@ -39,7 +39,7 @@ describe('LdapDropdownFooter', () => { }, store: createStore(), provide: { - namespace: MEMBER_TYPES.user, + namespace: MEMBERS_TAB_TYPES.user, }, mocks: { $toast, diff --git a/ee/spec/frontend/members/components/action_dropdowns/ldap_override_dropdown_item_spec.js b/ee/spec/frontend/members/components/action_dropdowns/ldap_override_dropdown_item_spec.js index 06418de6bf5b3..c1cfb755f0d78 100644 --- a/ee/spec/frontend/members/components/action_dropdowns/ldap_override_dropdown_item_spec.js +++ b/ee/spec/frontend/members/components/action_dropdowns/ldap_override_dropdown_item_spec.js @@ -5,7 +5,7 @@ import Vue from 'vue'; import Vuex from 'vuex'; import LdapOverrideDropdownItem from 'ee/members/components/action_dropdowns/ldap_override_dropdown_item.vue'; import { member } from 'jest/members/mock_data'; -import { MEMBER_TYPES } from '~/members/constants'; +import { MEMBERS_TAB_TYPES } from '~/members/constants'; Vue.use(Vuex); @@ -21,7 +21,7 @@ describe('LdapOverrideDropdownItem', () => { return new Vuex.Store({ modules: { - [MEMBER_TYPES.user]: { + [MEMBERS_TAB_TYPES.user]: { namespaced: true, actions, }, @@ -37,7 +37,7 @@ describe('LdapOverrideDropdownItem', () => { }, store: createStore(), provide: { - namespace: MEMBER_TYPES.user, + namespace: MEMBERS_TAB_TYPES.user, }, slots: { default: text, diff --git a/ee/spec/frontend/members/components/action_dropdowns/user_action_dropdown_spec.js b/ee/spec/frontend/members/components/action_dropdowns/user_action_dropdown_spec.js index d87d2ccbad814..c2fd2aadaf253 100644 --- a/ee/spec/frontend/members/components/action_dropdowns/user_action_dropdown_spec.js +++ b/ee/spec/frontend/members/components/action_dropdowns/user_action_dropdown_spec.js @@ -7,7 +7,7 @@ import { member } from 'jest/members/mock_data'; import { sprintf } from '~/locale'; import UserActionDropdown from '~/members/components/action_dropdowns/user_action_dropdown.vue'; import { I18N } from '~/members/components/action_dropdowns/constants'; -import { MEMBER_TYPES } from '~/members/constants'; +import { MEMBERS_TAB_TYPES } from '~/members/constants'; import { stubComponent } from 'helpers/stub_component'; describe('UserActionDropdown', () => { @@ -19,7 +19,7 @@ describe('UserActionDropdown', () => { BanMemberDropdownItem: stubComponent(BanMemberDropdownItem), }, provide: { - namespace: MEMBER_TYPES.user, + namespace: MEMBERS_TAB_TYPES.user, }, propsData: { member, diff --git a/ee/spec/frontend/members/components/filter_sort/members_filtered_search_bar_spec.js b/ee/spec/frontend/members/components/filter_sort/members_filtered_search_bar_spec.js index 980d34a6faf82..79e1a82845390 100644 --- a/ee/spec/frontend/members/components/filter_sort/members_filtered_search_bar_spec.js +++ b/ee/spec/frontend/members/components/filter_sort/members_filtered_search_bar_spec.js @@ -6,7 +6,7 @@ import setWindowLocation from 'helpers/set_window_location_helper'; import { visitUrl } from '~/lib/utils/url_utility'; import { __ } from '~/locale'; import MembersFilteredSearchBar from '~/members/components/filter_sort/members_filtered_search_bar.vue'; -import { MEMBER_TYPES } from '~/members/constants'; +import { MEMBERS_TAB_TYPES } from '~/members/constants'; import { FILTERED_SEARCH_TOKEN_ENTERPRISE, FILTERED_SEARCH_USER_TYPE } from 'ee/members/constants'; import FilteredSearchBar from '~/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue'; @@ -28,7 +28,7 @@ describe('MembersFilteredSearchBar', () => { const createComponent = ({ state = {}, provide = {} } = {}) => { const store = new Vuex.Store({ modules: { - [MEMBER_TYPES.user]: { + [MEMBERS_TAB_TYPES.user]: { namespaced: true, state: { filteredSearchBar: { @@ -49,7 +49,7 @@ describe('MembersFilteredSearchBar', () => { sourceId: 1, canManageMembers: true, canFilterByEnterprise: true, - namespace: MEMBER_TYPES.user, + namespace: MEMBERS_TAB_TYPES.user, ...provide, }, store, diff --git a/ee/spec/frontend/members/components/members_tabs_spec.js b/ee/spec/frontend/members/components/members_tabs_spec.js index cd40228a29fa3..d730bf5dc0e05 100644 --- a/ee/spec/frontend/members/components/members_tabs_spec.js +++ b/ee/spec/frontend/members/components/members_tabs_spec.js @@ -7,7 +7,7 @@ import { mountExtended } from 'helpers/vue_test_utils_helper'; import MembersApp from '~/members/components/app.vue'; import MembersTabs from '~/members/components/members_tabs.vue'; import { TABS } from 'ee_else_ce/members/tabs_metadata'; -import { MEMBER_TYPES, TAB_QUERY_PARAM_VALUES } from 'ee_else_ce/members/constants'; +import { MEMBERS_TAB_TYPES, TAB_QUERY_PARAM_VALUES } from 'ee_else_ce/members/constants'; import setWindowLocation from 'helpers/set_window_location_helper'; describe('MembersTabs', () => { @@ -19,7 +19,7 @@ describe('MembersTabs', () => { const createComponent = ({ totalItems = 10 } = {}) => { const store = new Vuex.Store({ modules: { - [MEMBER_TYPES.user]: { + [MEMBERS_TAB_TYPES.user]: { namespaced: true, state: { pagination: { @@ -31,7 +31,7 @@ describe('MembersTabs', () => { }, }, }, - [MEMBER_TYPES.promotionRequest]: { + [MEMBERS_TAB_TYPES.promotionRequest]: { namespaced: true, state: { pagination: { @@ -40,7 +40,7 @@ describe('MembersTabs', () => { }, }, }, - [MEMBER_TYPES.banned]: { + [MEMBERS_TAB_TYPES.banned]: { namespaced: true, state: { pagination: { @@ -87,12 +87,14 @@ describe('MembersTabs', () => { it('renders `MembersApp` and passes `namespace` and `tabQueryParamValue` props', () => { const membersApps = wrapper.findAllComponents(MembersApp).wrappers; - expect(membersApps[0].props('namespace')).toBe(MEMBER_TYPES.user); - expect(membersApps[1].props('namespace')).toBe(MEMBER_TYPES.banned); + expect(membersApps[0].props('namespace')).toBe(MEMBERS_TAB_TYPES.user); + expect(membersApps[1].props('namespace')).toBe(MEMBERS_TAB_TYPES.banned); }); it('renders the custom component for Promotion Requests', () => { - const promotionsTabMeta = TABS.find((tab) => tab.namespace === MEMBER_TYPES.promotionRequest); + const promotionsTabMeta = TABS.find( + (tab) => tab.namespace === MEMBERS_TAB_TYPES.promotionRequest, + ); expect(wrapper.findComponent(promotionsTabMeta.component).exists()).toBe(true); }); }); diff --git a/ee/spec/frontend/members/components/modals/disable_two_factor_modal_spec.js b/ee/spec/frontend/members/components/modals/disable_two_factor_modal_spec.js index 983eee75bc2a2..d968940131b59 100644 --- a/ee/spec/frontend/members/components/modals/disable_two_factor_modal_spec.js +++ b/ee/spec/frontend/members/components/modals/disable_two_factor_modal_spec.js @@ -5,7 +5,7 @@ import Vue from 'vue'; // eslint-disable-next-line no-restricted-imports import Vuex from 'vuex'; import DisableTwoFactorModal from 'ee/members/components/modals/disable_two_factor_modal.vue'; -import { MEMBER_TYPES } from '~/members/constants'; +import { MEMBERS_TAB_TYPES } from '~/members/constants'; import { DISABLE_TWO_FACTOR_MODAL_ID, I18N_CANCEL, @@ -31,7 +31,7 @@ describe('DisableTwoFactorModal', () => { const createStore = (state = {}) => { return new Vuex.Store({ modules: { - [MEMBER_TYPES.user]: { + [MEMBERS_TAB_TYPES.user]: { namespaced: true, state: { disableTwoFactorPath, @@ -52,7 +52,7 @@ describe('DisableTwoFactorModal', () => { wrapper = mount(DisableTwoFactorModal, { store: createStore(state), provide: { - namespace: MEMBER_TYPES.user, + namespace: MEMBERS_TAB_TYPES.user, }, attrs: { static: true, diff --git a/ee/spec/frontend/members/components/modals/ldap_override_confirmation_modal_spec.js b/ee/spec/frontend/members/components/modals/ldap_override_confirmation_modal_spec.js index 4d1183619cc16..6b2ef7a8f73bd 100644 --- a/ee/spec/frontend/members/components/modals/ldap_override_confirmation_modal_spec.js +++ b/ee/spec/frontend/members/components/modals/ldap_override_confirmation_modal_spec.js @@ -8,7 +8,7 @@ import LdapOverrideConfirmationModal from 'ee/members/components/modals/ldap_ove import { LDAP_OVERRIDE_CONFIRMATION_MODAL_ID } from 'ee/members/constants'; import waitForPromises from 'helpers/wait_for_promises'; import { member } from 'jest/members/mock_data'; -import { MEMBER_TYPES } from '~/members/constants'; +import { MEMBERS_TAB_TYPES } from '~/members/constants'; Vue.use(Vuex); @@ -33,7 +33,7 @@ describe('LdapOverrideConfirmationModal', () => { return new Vuex.Store({ modules: { - [MEMBER_TYPES.user]: { + [MEMBERS_TAB_TYPES.user]: { namespaced: true, state: { memberToOverride: member, @@ -50,7 +50,7 @@ describe('LdapOverrideConfirmationModal', () => { wrapper = mount(LdapOverrideConfirmationModal, { store: createStore(state), provide: { - namespace: MEMBER_TYPES.user, + namespace: MEMBERS_TAB_TYPES.user, }, attrs: { static: true, diff --git a/ee/spec/frontend/members/components/table/expiration_datepicker_spec.js b/ee/spec/frontend/members/components/table/expiration_datepicker_spec.js index 0a2c5b817716b..b3efd4580eba5 100644 --- a/ee/spec/frontend/members/components/table/expiration_datepicker_spec.js +++ b/ee/spec/frontend/members/components/table/expiration_datepicker_spec.js @@ -2,7 +2,7 @@ import { GlDatepicker } from '@gitlab/ui'; import { mount } from '@vue/test-utils'; import { member } from 'jest/members/mock_data'; import ExpirationDatepicker from '~/members/components/table/expiration_datepicker.vue'; -import { MEMBER_TYPES } from '~/members/constants'; +import { MEMBERS_TAB_TYPES } from '~/members/constants'; describe('ExpirationDatepicker', () => { let wrapper; @@ -10,7 +10,7 @@ describe('ExpirationDatepicker', () => { const createComponent = (propsData = {}) => { wrapper = mount(ExpirationDatepicker, { provide: { - namespace: MEMBER_TYPES.user, + namespace: MEMBERS_TAB_TYPES.user, }, propsData, }); diff --git a/ee/spec/frontend/members/components/table/max_role_spec.js b/ee/spec/frontend/members/components/table/max_role_spec.js index bb639abf2f8be..ee796d802e715 100644 --- a/ee/spec/frontend/members/components/table/max_role_spec.js +++ b/ee/spec/frontend/members/components/table/max_role_spec.js @@ -8,7 +8,7 @@ import ManageRolesDropdownFooter from 'ee/members/components/action_dropdowns/ma import { guestOverageConfirmAction } from 'ee/members/guest_overage_confirm_action'; import waitForPromises from 'helpers/wait_for_promises'; import MaxRole from '~/members/components/table/max_role.vue'; -import { MEMBER_TYPES } from '~/members/constants'; +import { MEMBERS_TAB_TYPES } from '~/members/constants'; import * as Sentry from '~/sentry/sentry_browser_wrapper'; import { s__ } from '~/locale'; import { createMockDirective, getBinding } from 'helpers/vue_mock_directive'; @@ -33,7 +33,7 @@ describe('MaxRole', () => { return new Vuex.Store({ modules: { - [MEMBER_TYPES.user]: { namespaced: true, actions }, + [MEMBERS_TAB_TYPES.user]: { namespaced: true, actions }, }, }); }; @@ -41,7 +41,7 @@ describe('MaxRole', () => { const createComponent = (propsData = {}, store = createStore()) => { wrapper = mountExtended(MaxRole, { provide: { - namespace: MEMBER_TYPES.user, + namespace: MEMBERS_TAB_TYPES.user, group: { name: 'groupname', path: '/grouppath/', diff --git a/ee/spec/frontend/members/components/table/member_action_buttons_spec.js b/ee/spec/frontend/members/components/table/member_action_buttons_spec.js index 33b1ff321a366..bf0ef3b0c6a67 100644 --- a/ee/spec/frontend/members/components/table/member_action_buttons_spec.js +++ b/ee/spec/frontend/members/components/table/member_action_buttons_spec.js @@ -12,7 +12,7 @@ import InviteActionButtons from '~/members/components/action_buttons/invite_acti import UserActionDropdown from '~/members/components/action_dropdowns/user_action_dropdown.vue'; import MemberActions from '~/members/components/table/member_actions.vue'; import BannedActionButtons from 'ee/members/components/action_buttons/banned_action_buttons.vue'; -import { MEMBER_TYPES } from 'ee_else_ce/members/constants'; +import { MEMBERS_TAB_TYPES } from 'ee_else_ce/members/constants'; import { stubComponent } from 'helpers/stub_component'; describe('MemberActionButtons', () => { @@ -33,12 +33,12 @@ describe('MemberActionButtons', () => { }; it.each` - memberType | member | expectedComponent | expectedComponentName - ${MEMBER_TYPES.user} | ${memberMock} | ${UserActionDropdown} | ${'UserActionDropdown'} - ${MEMBER_TYPES.group} | ${group} | ${GroupActionButtons} | ${'GroupActionButtons'} - ${MEMBER_TYPES.invite} | ${invite} | ${InviteActionButtons} | ${'InviteActionButtons'} - ${MEMBER_TYPES.accessRequest} | ${accessRequest} | ${AccessRequestActionButtons} | ${'AccessRequestActionButtons'} - ${MEMBER_TYPES.banned} | ${bannedMember} | ${BannedActionButtons} | ${'BannedActionButtons'} + memberType | member | expectedComponent | expectedComponentName + ${MEMBERS_TAB_TYPES.user} | ${memberMock} | ${UserActionDropdown} | ${'UserActionDropdown'} + ${MEMBERS_TAB_TYPES.group} | ${group} | ${GroupActionButtons} | ${'GroupActionButtons'} + ${MEMBERS_TAB_TYPES.invite} | ${invite} | ${InviteActionButtons} | ${'InviteActionButtons'} + ${MEMBERS_TAB_TYPES.accessRequest} | ${accessRequest} | ${AccessRequestActionButtons} | ${'AccessRequestActionButtons'} + ${MEMBERS_TAB_TYPES.banned} | ${bannedMember} | ${BannedActionButtons} | ${'BannedActionButtons'} `( 'renders $expectedComponentName when `memberType` is $memberType', ({ memberType, member, expectedComponent }) => { diff --git a/ee/spec/frontend/members/components/table/member_avatar_spec.js b/ee/spec/frontend/members/components/table/member_avatar_spec.js index 00e6b7a0cda61..66409d7c291d7 100644 --- a/ee/spec/frontend/members/components/table/member_avatar_spec.js +++ b/ee/spec/frontend/members/components/table/member_avatar_spec.js @@ -1,7 +1,7 @@ import { shallowMount } from '@vue/test-utils'; import UserAvatar from '~/members/components/avatars/user_avatar.vue'; import MemberAvatar from '~/members/components/table/member_avatar.vue'; -import { MEMBER_TYPES } from 'ee_else_ce/members/constants'; +import { MEMBERS_TAB_TYPES } from 'ee_else_ce/members/constants'; import { bannedMember } from 'ee_else_ce_jest/members/mock_data'; describe('MemberAvatar', () => { @@ -14,7 +14,7 @@ describe('MemberAvatar', () => { }; it('renders UserAvatar', () => { - createComponent({ memberType: MEMBER_TYPES.banned, member: bannedMember }); + createComponent({ memberType: MEMBERS_TAB_TYPES.banned, member: bannedMember }); expect(wrapper.findComponent(UserAvatar).exists()).toBe(true); }); diff --git a/ee/spec/frontend/members/components/table/members_table_cell_spec.js b/ee/spec/frontend/members/components/table/members_table_cell_spec.js index c4842257b1cbb..de6aa0fac385b 100644 --- a/ee/spec/frontend/members/components/table/members_table_cell_spec.js +++ b/ee/spec/frontend/members/components/table/members_table_cell_spec.js @@ -8,7 +8,7 @@ import { directMember, bannedMember, } from 'ee_else_ce_jest/members/mock_data'; -import { MEMBER_TYPES } from 'ee_else_ce/members/constants'; +import { MEMBERS_TAB_TYPES } from 'ee_else_ce/members/constants'; describe('MemberTableCell', () => { const WrappedComponent = { @@ -53,7 +53,7 @@ describe('MemberTableCell', () => { provide: { sourceId: 1, currentUserId: 1, - namespace: MEMBER_TYPES.user, + namespace: MEMBERS_TAB_TYPES.user, canManageMembers: true, ...provide, }, @@ -161,21 +161,21 @@ describe('MemberTableCell', () => { describe('memberType', () => { it('has memberType value from CE when user is not banned', () => { - createComponent({ member: directMember }, { namespace: MEMBER_TYPES.banned }); + createComponent({ member: directMember }, { namespace: MEMBERS_TAB_TYPES.banned }); - expect(findWrappedComponent().props('memberType')).not.toEqual(MEMBER_TYPES.banned); + expect(findWrappedComponent().props('memberType')).not.toEqual(MEMBERS_TAB_TYPES.banned); }); it('has memberType value from CE when namespace is not banned', () => { createComponent({ member: directMember }); - expect(findWrappedComponent().props('memberType')).not.toEqual(MEMBER_TYPES.banned); + expect(findWrappedComponent().props('memberType')).not.toEqual(MEMBERS_TAB_TYPES.banned); }); - it('is `MEMBER_TYPES.banned` when namespace is `MEMBER_TYPES.banned` and user is banned', () => { - createComponent({ member: bannedMember }, { namespace: MEMBER_TYPES.banned }); + it('is `MEMBERS_TAB_TYPES.banned` when namespace is `MEMBERS_TAB_TYPES.banned` and user is banned', () => { + createComponent({ member: bannedMember }, { namespace: MEMBERS_TAB_TYPES.banned }); - expect(findWrappedComponent().props('memberType')).toEqual(MEMBER_TYPES.banned); + expect(findWrappedComponent().props('memberType')).toEqual(MEMBERS_TAB_TYPES.banned); }); }); }); diff --git a/ee/spec/frontend/members/components/table/members_table_spec.js b/ee/spec/frontend/members/components/table/members_table_spec.js index 187ec57f3da5b..2aae5e21b2221 100644 --- a/ee/spec/frontend/members/components/table/members_table_spec.js +++ b/ee/spec/frontend/members/components/table/members_table_spec.js @@ -10,7 +10,7 @@ import { bannedMember, } from 'ee_jest/members/mock_data'; import MembersTable from '~/members/components/table/members_table.vue'; -import { MEMBER_TYPES, TAB_QUERY_PARAM_VALUES } from '~/members/constants'; +import { MEMBERS_TAB_TYPES, TAB_QUERY_PARAM_VALUES } from '~/members/constants'; Vue.use(Vuex); @@ -20,7 +20,7 @@ describe('MemberList', () => { const createStore = (state = {}) => { return new Vuex.Store({ modules: { - [MEMBER_TYPES.user]: { + [MEMBERS_TAB_TYPES.user]: { namespaced: true, state: { members: [], @@ -46,7 +46,7 @@ describe('MemberList', () => { provide: { sourceId: 1, currentUserId: 1, - namespace: MEMBER_TYPES.user, + namespace: MEMBERS_TAB_TYPES.user, canManageMembers: true, }, stubs: [ diff --git a/ee/spec/frontend/members/index_spec.js b/ee/spec/frontend/members/index_spec.js index 24ce048f38fd1..919726377af70 100644 --- a/ee/spec/frontend/members/index_spec.js +++ b/ee/spec/frontend/members/index_spec.js @@ -1,4 +1,4 @@ -import { MEMBER_TYPES } from 'ee/members/constants'; +import { MEMBERS_TAB_TYPES } from 'ee/members/constants'; import promotionRequestsTabStore from 'ee/members/promotion_requests/store'; import { dataAttribute } from 'ee_jest/members/mock_data'; import { initMembersApp } from '~/members/index'; @@ -16,8 +16,8 @@ describe('initMembersApp', () => { const setup = () => { vm = initMembersApp(el, { - [MEMBER_TYPES.user]: {}, - [MEMBER_TYPES.promotionRequest]: {}, + [MEMBERS_TAB_TYPES.user]: {}, + [MEMBERS_TAB_TYPES.promotionRequest]: {}, }); }; @@ -33,7 +33,7 @@ describe('initMembersApp', () => { it('sets `disableTwoFactorPath` in Vuex store', () => { setup(); - expect(vm.$store.state[MEMBER_TYPES.user].disableTwoFactorPath).toBe( + expect(vm.$store.state[MEMBERS_TAB_TYPES.user].disableTwoFactorPath).toBe( '/groups/ldap-group/-/two_factor_auth', ); }); @@ -41,7 +41,7 @@ describe('initMembersApp', () => { it('sets `ldapOverridePath` in Vuex store', () => { setup(); - expect(vm.$store.state[MEMBER_TYPES.user].ldapOverridePath).toBe( + expect(vm.$store.state[MEMBERS_TAB_TYPES.user].ldapOverridePath).toBe( '/groups/ldap-group/-/group_members/:id/override', ); }); @@ -52,7 +52,7 @@ describe('initMembersApp', () => { setup(); expect(promotionRequestsTabStore).toHaveBeenCalledWith( - parsedData[MEMBER_TYPES.promotionRequest], + parsedData[MEMBERS_TAB_TYPES.promotionRequest], ); }); }); diff --git a/ee/spec/frontend/members/mock_data.js b/ee/spec/frontend/members/mock_data.js index 38f832c29d79a..e2fb647f1cedb 100644 --- a/ee/spec/frontend/members/mock_data.js +++ b/ee/spec/frontend/members/mock_data.js @@ -1,5 +1,5 @@ import { member, dataAttribute as CEDataAttribute } from 'jest/members/mock_data'; -import { MEMBER_TYPES } from 'ee/members/constants'; +import { MEMBERS_TAB_TYPES } from 'ee/members/constants'; import { data as promotionRequestsData, pagination as promotionRequestsPagination, @@ -38,7 +38,7 @@ export const upgradedMember = { // eslint-disable-next-line import/export export const dataAttribute = JSON.stringify({ ...JSON.parse(CEDataAttribute), - [MEMBER_TYPES.promotionRequest]: { + [MEMBERS_TAB_TYPES.promotionRequest]: { data: promotionRequestsData, pagination: promotionRequestsPagination, }, diff --git a/ee/spec/frontend/members/promotion_requests/components/app_spec.js b/ee/spec/frontend/members/promotion_requests/components/app_spec.js index 1bc7418a18d24..db6ce8f007059 100644 --- a/ee/spec/frontend/members/promotion_requests/components/app_spec.js +++ b/ee/spec/frontend/members/promotion_requests/components/app_spec.js @@ -4,7 +4,7 @@ import Vuex from 'vuex'; import { GlTableLite } from '@gitlab/ui'; import { mountExtended } from 'helpers/vue_test_utils_helper'; import PromotionRequestsApp from 'ee/members/promotion_requests/components/app.vue'; -import { MEMBER_TYPES, TAB_QUERY_PARAM_VALUES } from 'ee_else_ce/members/constants'; +import { MEMBERS_TAB_TYPES, TAB_QUERY_PARAM_VALUES } from 'ee_else_ce/members/constants'; import initStore from 'ee/members/promotion_requests/store/index'; import MembersPagination from '~/members/components/table/members_pagination.vue'; import UserAvatar from '~/members/components/avatars/user_avatar.vue'; @@ -20,13 +20,13 @@ describe('PromotionRequestsApp', () => { const createComponent = ({ pagination = mockPagination } = {}) => { const store = new Vuex.Store({ modules: { - [MEMBER_TYPES.promotionRequest]: initStore({ data: mockData, pagination }), + [MEMBERS_TAB_TYPES.promotionRequest]: initStore({ data: mockData, pagination }), }, }); wrapper = mountExtended(PromotionRequestsApp, { propsData: { - namespace: MEMBER_TYPES.promotionRequest, + namespace: MEMBERS_TAB_TYPES.promotionRequest, tabQueryParamValue: TAB_QUERY_PARAM_VALUES.promotionRequest, }, provide: { canManageMembers: false }, diff --git a/spec/frontend/members/components/action_buttons/approve_access_request_button_spec.js b/spec/frontend/members/components/action_buttons/approve_access_request_button_spec.js index 3e88246ada093..04ab7306441b2 100644 --- a/spec/frontend/members/components/action_buttons/approve_access_request_button_spec.js +++ b/spec/frontend/members/components/action_buttons/approve_access_request_button_spec.js @@ -5,7 +5,7 @@ import Vue from 'vue'; import Vuex from 'vuex'; import { createMockDirective, getBinding } from 'helpers/vue_mock_directive'; import ApproveAccessRequestButton from '~/members/components/action_buttons/approve_access_request_button.vue'; -import { MEMBER_TYPES } from '~/members/constants'; +import { MEMBERS_TAB_TYPES } from '~/members/constants'; jest.mock('~/lib/utils/csrf', () => ({ token: 'mock-csrf-token' })); @@ -17,7 +17,7 @@ describe('ApproveAccessRequestButton', () => { const createStore = (state = {}) => { return new Vuex.Store({ modules: { - [MEMBER_TYPES.accessRequest]: { + [MEMBERS_TAB_TYPES.accessRequest]: { namespaced: true, state: { memberPath: '/groups/foo-bar/-/group_members/:id', @@ -32,7 +32,7 @@ describe('ApproveAccessRequestButton', () => { wrapper = shallowMount(ApproveAccessRequestButton, { store: createStore(state), provide: { - namespace: MEMBER_TYPES.accessRequest, + namespace: MEMBERS_TAB_TYPES.accessRequest, }, propsData: { memberId: 1, diff --git a/spec/frontend/members/components/action_buttons/remove_group_link_button_spec.js b/spec/frontend/members/components/action_buttons/remove_group_link_button_spec.js index 24a936abc9952..10632ac9a3e9d 100644 --- a/spec/frontend/members/components/action_buttons/remove_group_link_button_spec.js +++ b/spec/frontend/members/components/action_buttons/remove_group_link_button_spec.js @@ -5,7 +5,7 @@ import Vue from 'vue'; import Vuex from 'vuex'; import { createMockDirective, getBinding } from 'helpers/vue_mock_directive'; import RemoveGroupLinkButton from '~/members/components/action_buttons/remove_group_link_button.vue'; -import { MEMBER_TYPES } from '~/members/constants'; +import { MEMBERS_TAB_TYPES } from '~/members/constants'; import { group } from '../../mock_data'; Vue.use(Vuex); @@ -20,7 +20,7 @@ describe('RemoveGroupLinkButton', () => { const createStore = () => { return new Vuex.Store({ modules: { - [MEMBER_TYPES.group]: { + [MEMBERS_TAB_TYPES.group]: { namespaced: true, actions, }, @@ -32,7 +32,7 @@ describe('RemoveGroupLinkButton', () => { wrapper = mount(RemoveGroupLinkButton, { store: createStore(), provide: { - namespace: MEMBER_TYPES.group, + namespace: MEMBERS_TAB_TYPES.group, }, propsData: { groupLink: group, diff --git a/spec/frontend/members/components/action_buttons/remove_member_button_spec.js b/spec/frontend/members/components/action_buttons/remove_member_button_spec.js index 84393cb64eab4..db4d6b3ffc0c0 100644 --- a/spec/frontend/members/components/action_buttons/remove_member_button_spec.js +++ b/spec/frontend/members/components/action_buttons/remove_member_button_spec.js @@ -6,7 +6,7 @@ import Vuex from 'vuex'; import { createMockDirective, getBinding } from 'helpers/vue_mock_directive'; import { modalData } from 'jest/members/mock_data'; import RemoveMemberButton from '~/members/components/action_buttons/remove_member_button.vue'; -import { MEMBER_TYPES } from '~/members/constants'; +import { MEMBERS_TAB_TYPES } from '~/members/constants'; Vue.use(Vuex); @@ -20,7 +20,7 @@ describe('RemoveMemberButton', () => { const createStore = (state = {}) => { return new Vuex.Store({ modules: { - [MEMBER_TYPES.user]: { + [MEMBERS_TAB_TYPES.user]: { namespaced: true, state: { memberPath: '/groups/foo-bar/-/group_members/:id', @@ -36,7 +36,7 @@ describe('RemoveMemberButton', () => { wrapper = shallowMount(RemoveMemberButton, { store: createStore(state), provide: { - namespace: MEMBER_TYPES.user, + namespace: MEMBERS_TAB_TYPES.user, }, propsData: { memberId: 1, diff --git a/spec/frontend/members/components/action_buttons/resend_invite_button_spec.js b/spec/frontend/members/components/action_buttons/resend_invite_button_spec.js index 50facbf7f5dba..f7a3bde7a3cb5 100644 --- a/spec/frontend/members/components/action_buttons/resend_invite_button_spec.js +++ b/spec/frontend/members/components/action_buttons/resend_invite_button_spec.js @@ -5,7 +5,7 @@ import Vue from 'vue'; import Vuex from 'vuex'; import { createMockDirective, getBinding } from 'helpers/vue_mock_directive'; import ResendInviteButton from '~/members/components/action_buttons/resend_invite_button.vue'; -import { MEMBER_TYPES } from '~/members/constants'; +import { MEMBERS_TAB_TYPES } from '~/members/constants'; jest.mock('~/lib/utils/csrf', () => ({ token: 'mock-csrf-token' })); @@ -17,7 +17,7 @@ describe('ResendInviteButton', () => { const createStore = (state = {}) => { return new Vuex.Store({ modules: { - [MEMBER_TYPES.invite]: { + [MEMBERS_TAB_TYPES.invite]: { namespaced: true, state: { memberPath: '/groups/foo-bar/-/group_members/:id', @@ -32,7 +32,7 @@ describe('ResendInviteButton', () => { wrapper = shallowMount(ResendInviteButton, { store: createStore(state), provide: { - namespace: MEMBER_TYPES.invite, + namespace: MEMBERS_TAB_TYPES.invite, }, propsData: { memberId: 1, diff --git a/spec/frontend/members/components/action_dropdowns/remove_member_dropdown_item_spec.js b/spec/frontend/members/components/action_dropdowns/remove_member_dropdown_item_spec.js index be53c48c9fd78..a1dab869f52ae 100644 --- a/spec/frontend/members/components/action_dropdowns/remove_member_dropdown_item_spec.js +++ b/spec/frontend/members/components/action_dropdowns/remove_member_dropdown_item_spec.js @@ -5,7 +5,7 @@ import Vue from 'vue'; import Vuex from 'vuex'; import { modalData } from 'jest/members/mock_data'; import RemoveMemberDropdownItem from '~/members/components/action_dropdowns/remove_member_dropdown_item.vue'; -import { MEMBER_TYPES, MEMBER_MODEL_TYPE_GROUP_MEMBER } from '~/members/constants'; +import { MEMBERS_TAB_TYPES, MEMBER_MODEL_TYPE_GROUP_MEMBER } from '~/members/constants'; Vue.use(Vuex); @@ -20,7 +20,7 @@ describe('RemoveMemberDropdownItem', () => { const createStore = (state = {}) => { return new Vuex.Store({ modules: { - [MEMBER_TYPES.user]: { + [MEMBERS_TAB_TYPES.user]: { namespaced: true, state: { memberPath: '/groups/foo-bar/-/group_members/:id', @@ -36,7 +36,7 @@ describe('RemoveMemberDropdownItem', () => { wrapper = shallowMount(RemoveMemberDropdownItem, { store: createStore(state), provide: { - namespace: MEMBER_TYPES.user, + namespace: MEMBERS_TAB_TYPES.user, }, propsData: { memberId: 1, diff --git a/spec/frontend/members/components/app_spec.js b/spec/frontend/members/components/app_spec.js index 929a5a054e64e..806ebf9dd8d9d 100644 --- a/spec/frontend/members/components/app_spec.js +++ b/spec/frontend/members/components/app_spec.js @@ -7,7 +7,7 @@ import * as commonUtils from '~/lib/utils/common_utils'; import MembersApp from '~/members/components/app.vue'; import FilterSortContainer from '~/members/components/filter_sort/filter_sort_container.vue'; import MembersTable from '~/members/components/table/members_table.vue'; -import { MEMBER_TYPES, TAB_QUERY_PARAM_VALUES } from '~/members/constants'; +import { MEMBERS_TAB_TYPES, TAB_QUERY_PARAM_VALUES } from '~/members/constants'; import { RECEIVE_MEMBER_ROLE_ERROR, HIDE_ERROR } from '~/members/store/mutation_types'; import mutations from '~/members/store/mutations'; @@ -20,7 +20,7 @@ describe('MembersApp', () => { const createComponent = (state = {}, options = {}) => { store = new Vuex.Store({ modules: { - [MEMBER_TYPES.group]: { + [MEMBERS_TAB_TYPES.group]: { namespaced: true, state: { showError: true, @@ -34,7 +34,7 @@ describe('MembersApp', () => { wrapper = shallowMount(MembersApp, { propsData: { - namespace: MEMBER_TYPES.group, + namespace: MEMBERS_TAB_TYPES.group, tabQueryParamValue: TAB_QUERY_PARAM_VALUES.group, }, store, @@ -57,7 +57,7 @@ describe('MembersApp', () => { it('renders and scrolls to error alert', async () => { createComponent({ showError: false, errorMessage: '' }); - store.commit(`${MEMBER_TYPES.group}/${RECEIVE_MEMBER_ROLE_ERROR}`, { + store.commit(`${MEMBERS_TAB_TYPES.group}/${RECEIVE_MEMBER_ROLE_ERROR}`, { error: new Error('Network Error'), }); @@ -77,7 +77,7 @@ describe('MembersApp', () => { it('does not render and scroll to error alert', async () => { createComponent(); - store.commit(`${MEMBER_TYPES.group}/${HIDE_ERROR}`); + store.commit(`${MEMBERS_TAB_TYPES.group}/${HIDE_ERROR}`); await nextTick(); diff --git a/spec/frontend/members/components/filter_sort/filter_sort_container_spec.js b/spec/frontend/members/components/filter_sort/filter_sort_container_spec.js index 6bb51b4633c95..6c7d9e17eb408 100644 --- a/spec/frontend/members/components/filter_sort/filter_sort_container_spec.js +++ b/spec/frontend/members/components/filter_sort/filter_sort_container_spec.js @@ -5,7 +5,7 @@ import Vuex from 'vuex'; import FilterSortContainer from '~/members/components/filter_sort/filter_sort_container.vue'; import MembersFilteredSearchBar from '~/members/components/filter_sort/members_filtered_search_bar.vue'; import SortDropdown from '~/members/components/filter_sort/sort_dropdown.vue'; -import { MEMBER_TYPES } from '~/members/constants'; +import { MEMBERS_TAB_TYPES } from '~/members/constants'; Vue.use(Vuex); @@ -15,7 +15,7 @@ describe('FilterSortContainer', () => { const createComponent = (state) => { const store = new Vuex.Store({ modules: { - [MEMBER_TYPES.user]: { + [MEMBERS_TAB_TYPES.user]: { namespaced: true, state: { filteredSearchBar: { @@ -35,7 +35,7 @@ describe('FilterSortContainer', () => { wrapper = shallowMount(FilterSortContainer, { store, provide: { - namespace: MEMBER_TYPES.user, + namespace: MEMBERS_TAB_TYPES.user, }, }); }; diff --git a/spec/frontend/members/components/filter_sort/members_filtered_search_bar_spec.js b/spec/frontend/members/components/filter_sort/members_filtered_search_bar_spec.js index 86fb30568b4dc..bdaf9fbb2987c 100644 --- a/spec/frontend/members/components/filter_sort/members_filtered_search_bar_spec.js +++ b/spec/frontend/members/components/filter_sort/members_filtered_search_bar_spec.js @@ -6,7 +6,7 @@ import setWindowLocation from 'helpers/set_window_location_helper'; import { visitUrl } from '~/lib/utils/url_utility'; import MembersFilteredSearchBar from '~/members/components/filter_sort/members_filtered_search_bar.vue'; import { - MEMBER_TYPES, + MEMBERS_TAB_TYPES, FILTERED_SEARCH_TOKEN_TWO_FACTOR, FILTERED_SEARCH_TOKEN_WITH_INHERITED_PERMISSIONS, } from '~/members/constants'; @@ -31,7 +31,7 @@ describe('MembersFilteredSearchBar', () => { const createComponent = ({ state = {}, provide = {} } = {}) => { const store = new Vuex.Store({ modules: { - [MEMBER_TYPES.user]: { + [MEMBERS_TAB_TYPES.user]: { namespaced: true, state: { filteredSearchBar: { @@ -51,7 +51,7 @@ describe('MembersFilteredSearchBar', () => { provide: { sourceId: 1, canManageMembers: true, - namespace: MEMBER_TYPES.user, + namespace: MEMBERS_TAB_TYPES.user, ...provide, }, store, diff --git a/spec/frontend/members/components/filter_sort/sort_dropdown_spec.js b/spec/frontend/members/components/filter_sort/sort_dropdown_spec.js index 1f98d0e7ce08c..e62e806539896 100644 --- a/spec/frontend/members/components/filter_sort/sort_dropdown_spec.js +++ b/spec/frontend/members/components/filter_sort/sort_dropdown_spec.js @@ -6,7 +6,7 @@ import Vuex from 'vuex'; import setWindowLocation from 'helpers/set_window_location_helper'; import * as urlUtilities from '~/lib/utils/url_utility'; import SortDropdown from '~/members/components/filter_sort/sort_dropdown.vue'; -import { MEMBER_TYPES, FIELD_KEY_MAX_ROLE } from '~/members/constants'; +import { MEMBERS_TAB_TYPES, FIELD_KEY_MAX_ROLE } from '~/members/constants'; Vue.use(Vuex); @@ -18,7 +18,7 @@ describe('SortDropdown', () => { const createComponent = (state) => { const store = new Vuex.Store({ modules: { - [MEMBER_TYPES.user]: { + [MEMBERS_TAB_TYPES.user]: { namespaced: true, state: { tableSortableFields: ['account', 'granted', 'expires', 'maxRole', 'lastSignIn'], @@ -38,7 +38,7 @@ describe('SortDropdown', () => { wrapper = mount(SortDropdown, { provide: { sourceId: 1, - namespace: MEMBER_TYPES.user, + namespace: MEMBERS_TAB_TYPES.user, }, store, }); diff --git a/spec/frontend/members/components/members_tabs_spec.js b/spec/frontend/members/components/members_tabs_spec.js index adb940fbfe010..086d54e8d37b1 100644 --- a/spec/frontend/members/components/members_tabs_spec.js +++ b/spec/frontend/members/components/members_tabs_spec.js @@ -7,7 +7,7 @@ import { mountExtended } from 'helpers/vue_test_utils_helper'; import MembersApp from '~/members/components/app.vue'; import MembersTabs from '~/members/components/members_tabs.vue'; import { - MEMBER_TYPES, + MEMBERS_TAB_TYPES, TAB_QUERY_PARAM_VALUES, ACTIVE_TAB_QUERY_PARAM_NAME, FILTERED_SEARCH_TOKEN_GROUPS_WITH_INHERITED_PERMISSIONS, @@ -23,7 +23,7 @@ describe('MembersTabs', () => { const createComponent = ({ totalItems = 10, provide = {} } = {}) => { const store = new Vuex.Store({ modules: { - [MEMBER_TYPES.user]: { + [MEMBERS_TAB_TYPES.user]: { namespaced: true, state: { pagination: { @@ -35,7 +35,7 @@ describe('MembersTabs', () => { }, }, }, - [MEMBER_TYPES.group]: { + [MEMBERS_TAB_TYPES.group]: { namespaced: true, state: { pagination: { @@ -49,7 +49,7 @@ describe('MembersTabs', () => { }, }, }, - [MEMBER_TYPES.invite]: { + [MEMBERS_TAB_TYPES.invite]: { namespaced: true, state: { pagination: { @@ -62,7 +62,7 @@ describe('MembersTabs', () => { }, }, }, - [MEMBER_TYPES.accessRequest]: { + [MEMBERS_TAB_TYPES.accessRequest]: { namespaced: true, state: { pagination: { @@ -132,10 +132,10 @@ describe('MembersTabs', () => { const membersApps = wrapper.findAllComponents(MembersApp).wrappers; - expect(membersApps[0].props('namespace')).toBe(MEMBER_TYPES.user); - expect(membersApps[1].props('namespace')).toBe(MEMBER_TYPES.group); - expect(membersApps[2].props('namespace')).toBe(MEMBER_TYPES.invite); - expect(membersApps[3].props('namespace')).toBe(MEMBER_TYPES.accessRequest); + expect(membersApps[0].props('namespace')).toBe(MEMBERS_TAB_TYPES.user); + expect(membersApps[1].props('namespace')).toBe(MEMBERS_TAB_TYPES.group); + expect(membersApps[2].props('namespace')).toBe(MEMBERS_TAB_TYPES.invite); + expect(membersApps[3].props('namespace')).toBe(MEMBERS_TAB_TYPES.accessRequest); expect(membersApps[1].props('tabQueryParamValue')).toBe(TAB_QUERY_PARAM_VALUES.group); expect(membersApps[2].props('tabQueryParamValue')).toBe(TAB_QUERY_PARAM_VALUES.invite); diff --git a/spec/frontend/members/components/modals/leave_modal_spec.js b/spec/frontend/members/components/modals/leave_modal_spec.js index 95a4fb0785360..3b2b8cee08f3a 100644 --- a/spec/frontend/members/components/modals/leave_modal_spec.js +++ b/spec/frontend/members/components/modals/leave_modal_spec.js @@ -7,7 +7,7 @@ import { mountExtended, extendedWrapper } from 'helpers/vue_test_utils_helper'; import LeaveModal from '~/members/components/modals/leave_modal.vue'; import { LEAVE_MODAL_ID, - MEMBER_TYPES, + MEMBERS_TAB_TYPES, MEMBER_MODEL_TYPE_PROJECT_MEMBER, } from '~/members/constants'; import UserDeletionObstaclesList from '~/vue_shared/components/user_deletion_obstacles/user_deletion_obstacles_list.vue'; @@ -24,7 +24,7 @@ describe('LeaveModal', () => { const createStore = (state = {}) => { return new Vuex.Store({ modules: { - [MEMBER_TYPES.user]: { + [MEMBERS_TAB_TYPES.user]: { namespaced: true, state: { memberPath: '/groups/foo-bar/-/group_members/:id', @@ -39,7 +39,7 @@ describe('LeaveModal', () => { wrapper = mountExtended(LeaveModal, { store: createStore(state), provide: { - namespace: MEMBER_TYPES.user, + namespace: MEMBERS_TAB_TYPES.user, }, propsData: { member, diff --git a/spec/frontend/members/components/modals/remove_group_link_modal_spec.js b/spec/frontend/members/components/modals/remove_group_link_modal_spec.js index bde33528eb8f3..6f3a5141772cc 100644 --- a/spec/frontend/members/components/modals/remove_group_link_modal_spec.js +++ b/spec/frontend/members/components/modals/remove_group_link_modal_spec.js @@ -5,7 +5,7 @@ import Vue, { nextTick } from 'vue'; // eslint-disable-next-line no-restricted-imports import Vuex from 'vuex'; import RemoveGroupLinkModal from '~/members/components/modals/remove_group_link_modal.vue'; -import { REMOVE_GROUP_LINK_MODAL_ID, MEMBER_TYPES } from '~/members/constants'; +import { REMOVE_GROUP_LINK_MODAL_ID, MEMBERS_TAB_TYPES } from '~/members/constants'; import { group } from '../../mock_data'; jest.mock('~/lib/utils/csrf', () => ({ token: 'mock-csrf-token' })); @@ -22,7 +22,7 @@ describe('RemoveGroupLinkModal', () => { const createStore = (state = {}) => { return new Vuex.Store({ modules: { - [MEMBER_TYPES.group]: { + [MEMBERS_TAB_TYPES.group]: { namespaced: true, state: { memberPath: '/groups/foo-bar/-/group_links/:id', @@ -40,7 +40,7 @@ describe('RemoveGroupLinkModal', () => { wrapper = mount(RemoveGroupLinkModal, { store: createStore(state), provide: { - namespace: MEMBER_TYPES.group, + namespace: MEMBERS_TAB_TYPES.group, }, attrs: { static: true, diff --git a/spec/frontend/members/components/modals/remove_member_modal_spec.js b/spec/frontend/members/components/modals/remove_member_modal_spec.js index 01138ff845dc2..acb873263000e 100644 --- a/spec/frontend/members/components/modals/remove_member_modal_spec.js +++ b/spec/frontend/members/components/modals/remove_member_modal_spec.js @@ -5,7 +5,7 @@ import Vue from 'vue'; import Vuex from 'vuex'; import RemoveMemberModal from '~/members/components/modals/remove_member_modal.vue'; import { - MEMBER_TYPES, + MEMBERS_TAB_TYPES, MEMBER_MODEL_TYPE_GROUP_MEMBER, MEMBER_MODEL_TYPE_PROJECT_MEMBER, } from '~/members/constants'; @@ -32,7 +32,7 @@ describe('RemoveMemberModal', () => { const createStore = (removeMemberModalData) => new Vuex.Store({ modules: { - [MEMBER_TYPES.user]: { + [MEMBERS_TAB_TYPES.user]: { namespaced: true, state: { removeMemberModalData, @@ -46,7 +46,7 @@ describe('RemoveMemberModal', () => { wrapper = shallowMount(RemoveMemberModal, { store: createStore(state), provide: { - namespace: MEMBER_TYPES.user, + namespace: MEMBERS_TAB_TYPES.user, }, }); }; diff --git a/spec/frontend/members/components/table/expiration_datepicker_spec.js b/spec/frontend/members/components/table/expiration_datepicker_spec.js index d9847abda52b8..67e8ef831f145 100644 --- a/spec/frontend/members/components/table/expiration_datepicker_spec.js +++ b/spec/frontend/members/components/table/expiration_datepicker_spec.js @@ -6,7 +6,7 @@ import Vuex from 'vuex'; import { useFakeDate } from 'helpers/fake_date'; import waitForPromises from 'helpers/wait_for_promises'; import ExpirationDatepicker from '~/members/components/table/expiration_datepicker.vue'; -import { MEMBER_TYPES } from '~/members/constants'; +import { MEMBERS_TAB_TYPES } from '~/members/constants'; import { member } from '../../mock_data'; Vue.use(Vuex); @@ -34,7 +34,7 @@ describe('ExpirationDatepicker', () => { return new Vuex.Store({ modules: { - [MEMBER_TYPES.user]: { namespaced: true, actions }, + [MEMBERS_TAB_TYPES.user]: { namespaced: true, actions }, }, }); }; @@ -47,7 +47,7 @@ describe('ExpirationDatepicker', () => { ...propsData, }, provide: { - namespace: MEMBER_TYPES.user, + namespace: MEMBERS_TAB_TYPES.user, }, store: createStore(), mocks: { diff --git a/spec/frontend/members/components/table/max_role_spec.js b/spec/frontend/members/components/table/max_role_spec.js index 6c086ee813ac7..5d99671c45d53 100644 --- a/spec/frontend/members/components/table/max_role_spec.js +++ b/spec/frontend/members/components/table/max_role_spec.js @@ -7,7 +7,7 @@ import Vuex from 'vuex'; import * as Sentry from '~/sentry/sentry_browser_wrapper'; import waitForPromises from 'helpers/wait_for_promises'; import MaxRole from '~/members/components/table/max_role.vue'; -import { MEMBER_TYPES } from '~/members/constants'; +import { MEMBERS_TAB_TYPES } from '~/members/constants'; import { guestOverageConfirmAction } from 'ee_else_ce/members/guest_overage_confirm_action'; import { logError } from '~/lib/logger'; import * as utils from 'ee_else_ce/members/utils'; @@ -36,7 +36,7 @@ describe('MaxRole', () => { return new Vuex.Store({ modules: { - [MEMBER_TYPES.user]: { namespaced: true, actions }, + [MEMBERS_TAB_TYPES.user]: { namespaced: true, actions }, }, }); }; @@ -44,7 +44,7 @@ describe('MaxRole', () => { const createComponent = (propsData = {}, store = createStore()) => { wrapper = mount(MaxRole, { provide: { - namespace: MEMBER_TYPES.user, + namespace: MEMBERS_TAB_TYPES.user, group: { name: 'groupname', path: '/grouppath/', diff --git a/spec/frontend/members/components/table/member_action_buttons_spec.js b/spec/frontend/members/components/table/member_action_buttons_spec.js index 3a04d1dcb0aad..c8080908ff5d3 100644 --- a/spec/frontend/members/components/table/member_action_buttons_spec.js +++ b/spec/frontend/members/components/table/member_action_buttons_spec.js @@ -4,7 +4,7 @@ import GroupActionButtons from '~/members/components/action_buttons/group_action import InviteActionButtons from '~/members/components/action_buttons/invite_action_buttons.vue'; import UserActionDropdown from '~/members/components/action_dropdowns/user_action_dropdown.vue'; import MemberActions from '~/members/components/table/member_actions.vue'; -import { MEMBER_TYPES } from '~/members/constants'; +import { MEMBERS_TAB_TYPES } from '~/members/constants'; import { member as memberMock, group, invite, accessRequest } from '../../mock_data'; describe('MemberActions', () => { @@ -24,11 +24,11 @@ describe('MemberActions', () => { }; it.each` - memberType | member | expectedComponent | expectedComponentName - ${MEMBER_TYPES.user} | ${memberMock} | ${UserActionDropdown} | ${'UserActionDropdown'} - ${MEMBER_TYPES.group} | ${group} | ${GroupActionButtons} | ${'GroupActionButtons'} - ${MEMBER_TYPES.invite} | ${invite} | ${InviteActionButtons} | ${'InviteActionButtons'} - ${MEMBER_TYPES.accessRequest} | ${accessRequest} | ${AccessRequestActionButtons} | ${'AccessRequestActionButtons'} + memberType | member | expectedComponent | expectedComponentName + ${MEMBERS_TAB_TYPES.user} | ${memberMock} | ${UserActionDropdown} | ${'UserActionDropdown'} + ${MEMBERS_TAB_TYPES.group} | ${group} | ${GroupActionButtons} | ${'GroupActionButtons'} + ${MEMBERS_TAB_TYPES.invite} | ${invite} | ${InviteActionButtons} | ${'InviteActionButtons'} + ${MEMBERS_TAB_TYPES.accessRequest} | ${accessRequest} | ${AccessRequestActionButtons} | ${'AccessRequestActionButtons'} `( 'renders $expectedComponentName when `memberType` is $memberType', ({ memberType, member, expectedComponent }) => { diff --git a/spec/frontend/members/components/table/member_avatar_spec.js b/spec/frontend/members/components/table/member_avatar_spec.js index 369f8a06cfd85..f45921a250199 100644 --- a/spec/frontend/members/components/table/member_avatar_spec.js +++ b/spec/frontend/members/components/table/member_avatar_spec.js @@ -3,7 +3,7 @@ import GroupAvatar from '~/members/components/avatars/group_avatar.vue'; import InviteAvatar from '~/members/components/avatars/invite_avatar.vue'; import UserAvatar from '~/members/components/avatars/user_avatar.vue'; import MemberAvatar from '~/members/components/table/member_avatar.vue'; -import { MEMBER_TYPES } from '~/members/constants'; +import { MEMBERS_TAB_TYPES } from '~/members/constants'; import { member as memberMock, group, invite, accessRequest } from '../../mock_data'; describe('MemberList', () => { @@ -19,11 +19,11 @@ describe('MemberList', () => { }; it.each` - memberType | member | expectedComponent | expectedComponentName - ${MEMBER_TYPES.user} | ${memberMock} | ${UserAvatar} | ${'UserAvatar'} - ${MEMBER_TYPES.group} | ${group} | ${GroupAvatar} | ${'GroupAvatar'} - ${MEMBER_TYPES.invite} | ${invite} | ${InviteAvatar} | ${'InviteAvatar'} - ${MEMBER_TYPES.accessRequest} | ${accessRequest} | ${UserAvatar} | ${'UserAvatar'} + memberType | member | expectedComponent | expectedComponentName + ${MEMBERS_TAB_TYPES.user} | ${memberMock} | ${UserAvatar} | ${'UserAvatar'} + ${MEMBERS_TAB_TYPES.group} | ${group} | ${GroupAvatar} | ${'GroupAvatar'} + ${MEMBERS_TAB_TYPES.invite} | ${invite} | ${InviteAvatar} | ${'InviteAvatar'} + ${MEMBERS_TAB_TYPES.accessRequest} | ${accessRequest} | ${UserAvatar} | ${'UserAvatar'} `( 'renders $expectedComponentName when `memberType` is $memberType', ({ memberType, member, expectedComponent }) => { diff --git a/spec/frontend/members/components/table/members_table_cell_spec.js b/spec/frontend/members/components/table/members_table_cell_spec.js index 099fe7b4b8a52..8b5e6f84ba4e9 100644 --- a/spec/frontend/members/components/table/members_table_cell_spec.js +++ b/spec/frontend/members/components/table/members_table_cell_spec.js @@ -3,7 +3,7 @@ import Vue from 'vue'; // eslint-disable-next-line no-restricted-imports import Vuex from 'vuex'; import MembersTableCell from '~/members/components/table/members_table_cell.vue'; -import { MEMBER_TYPES } from '~/members/constants'; +import { MEMBERS_TAB_TYPES } from '~/members/constants'; import { canRemoveBlockedByLastOwner } from '~/members/utils'; import { member as memberMock, @@ -100,10 +100,10 @@ describe('MembersTableCell', () => { it.each` member | expectedMemberType - ${memberMock} | ${MEMBER_TYPES.user} - ${group} | ${MEMBER_TYPES.group} - ${invite} | ${MEMBER_TYPES.invite} - ${accessRequest} | ${MEMBER_TYPES.accessRequest} + ${memberMock} | ${MEMBERS_TAB_TYPES.user} + ${group} | ${MEMBERS_TAB_TYPES.group} + ${invite} | ${MEMBERS_TAB_TYPES.invite} + ${accessRequest} | ${MEMBERS_TAB_TYPES.accessRequest} `( 'sets scoped slot prop `memberType` to $expectedMemberType', ({ member, expectedMemberType }) => { diff --git a/spec/frontend/members/components/table/members_table_spec.js b/spec/frontend/members/components/table/members_table_spec.js index 242efbbbabe01..2cdf152b7f391 100644 --- a/spec/frontend/members/components/table/members_table_spec.js +++ b/spec/frontend/members/components/table/members_table_spec.js @@ -15,7 +15,7 @@ import MembersPagination from '~/members/components/table/members_pagination.vue import MaxRole from '~/members/components/table/max_role.vue'; import RoleDetailsDrawer from '~/members/components/table/role_details_drawer.vue'; import { - MEMBER_TYPES, + MEMBERS_TAB_TYPES, MEMBER_STATE_CREATED, MEMBER_STATE_AWAITING, MEMBER_STATE_ACTIVE, @@ -42,7 +42,7 @@ describe('MembersTable', () => { const createStore = (state = {}) => { return new Vuex.Store({ modules: { - [MEMBER_TYPES.invite]: { + [MEMBERS_TAB_TYPES.invite]: { namespaced: true, state: { members: [], @@ -68,7 +68,7 @@ describe('MembersTable', () => { sourceId: 1, currentUserId: 1, canManageMembers: true, - namespace: MEMBER_TYPES.invite, + namespace: MEMBERS_TAB_TYPES.invite, namespaceReachedLimit: false, namespaceUserLimit: 1, glFeatures: { showRoleDetailsInDrawer }, diff --git a/spec/frontend/members/index_spec.js b/spec/frontend/members/index_spec.js index e453a21ae3a69..71686fd6bda53 100644 --- a/spec/frontend/members/index_spec.js +++ b/spec/frontend/members/index_spec.js @@ -1,6 +1,6 @@ import { createWrapper } from '@vue/test-utils'; import MembersTabs from '~/members/components/members_tabs.vue'; -import { MEMBER_TYPES } from '~/members/constants'; +import { MEMBERS_TAB_TYPES } from '~/members/constants'; import { initMembersApp } from '~/members/index'; import membersStore from '~/members/store'; import { parseDataAttributes } from '~/members/utils'; @@ -17,7 +17,7 @@ describe('initMembersApp', () => { let wrapper; const options = { - [MEMBER_TYPES.user]: { + [MEMBERS_TAB_TYPES.user]: { tableFields: ['account'], tableAttrs: { table: { 'data-testid': 'members-list' } }, tableSortableFields: ['account'], @@ -54,8 +54,8 @@ describe('initMembersApp', () => { setup(); expect(membersStore).toHaveBeenCalledWith({ - ...parsedData[MEMBER_TYPES.user], - ...options[MEMBER_TYPES.user], + ...parsedData[MEMBERS_TAB_TYPES.user], + ...options[MEMBERS_TAB_TYPES.user], }); }); }); diff --git a/spec/frontend/members/mock_data.js b/spec/frontend/members/mock_data.js index b7aa31dae576f..b40a2caf3c01d 100644 --- a/spec/frontend/members/mock_data.js +++ b/spec/frontend/members/mock_data.js @@ -1,5 +1,5 @@ import { - MEMBER_TYPES, + MEMBERS_TAB_TYPES, MEMBER_STATE_CREATED, MEMBER_MODEL_TYPE_GROUP_MEMBER, } from '~/members/constants'; @@ -156,7 +156,7 @@ export const pagination = { }; export const dataAttribute = JSON.stringify({ - [MEMBER_TYPES.user]: { + [MEMBERS_TAB_TYPES.user]: { members, pagination: paginationData, member_path: '/groups/foo-bar/-/group_members/:id', diff --git a/spec/frontend/members/utils_spec.js b/spec/frontend/members/utils_spec.js index 874ad64c5e5de..2c252b36478c0 100644 --- a/spec/frontend/members/utils_spec.js +++ b/spec/frontend/members/utils_spec.js @@ -1,7 +1,7 @@ import setWindowLocation from 'helpers/set_window_location_helper'; import { DEFAULT_SORT, - MEMBER_TYPES, + MEMBERS_TAB_TYPES, I18N_USER_YOU, I18N_USER_BLOCKED, I18N_USER_BOT, @@ -306,7 +306,7 @@ describe('Members Utils', () => { it('correctly parses the data attribute', () => { expect(parseDataAttributes(el)).toMatchObject({ - [MEMBER_TYPES.user]: { + [MEMBERS_TAB_TYPES.user]: { members, pagination, memberPath: '/groups/foo-bar/-/group_members/:id', -- GitLab