diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 09:08:42 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 09:08:42 +0000 |
commit | b76ae638462ab0f673e5915986070518dd3f9ad3 (patch) | |
tree | bdab0533383b52873be0ec0eb4d3c66598ff8b91 /spec/frontend/admin/users/components/actions/actions_spec.js | |
parent | 434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff) | |
download | gitlab-ce-b76ae638462ab0f673e5915986070518dd3f9ad3.tar.gz |
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'spec/frontend/admin/users/components/actions/actions_spec.js')
-rw-r--r-- | spec/frontend/admin/users/components/actions/actions_spec.js | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/spec/frontend/admin/users/components/actions/actions_spec.js b/spec/frontend/admin/users/components/actions/actions_spec.js index 67d9bac8580..fd05b08a3fb 100644 --- a/spec/frontend/admin/users/components/actions/actions_spec.js +++ b/spec/frontend/admin/users/components/actions/actions_spec.js @@ -5,8 +5,8 @@ import { nextTick } from 'vue'; import Actions from '~/admin/users/components/actions'; import SharedDeleteAction from '~/admin/users/components/actions/shared/shared_delete_action.vue'; import { capitalizeFirstCharacter } from '~/lib/utils/text_utility'; - import { CONFIRMATION_ACTIONS, DELETE_ACTIONS } from '../../constants'; +import { paths } from '../../mock_data'; describe('Action components', () => { let wrapper; @@ -47,32 +47,33 @@ describe('Action components', () => { describe('DELETE_ACTION_COMPONENTS', () => { const oncallSchedules = [{ name: 'schedule1' }, { name: 'schedule2' }]; - it.each(DELETE_ACTIONS)('renders a dropdown item for "%s"', async (action) => { - initComponent({ - component: Actions[capitalizeFirstCharacter(action)], - props: { - username: 'John Doe', - paths: { - delete: '/delete', - block: '/block', + + it.each(DELETE_ACTIONS.map((action) => [action, paths[action]]))( + 'renders a dropdown item for "%s"', + async (action, expectedPath) => { + initComponent({ + component: Actions[capitalizeFirstCharacter(action)], + props: { + username: 'John Doe', + paths, + oncallSchedules, }, - oncallSchedules, - }, - stubs: { SharedDeleteAction }, - }); + stubs: { SharedDeleteAction }, + }); - await nextTick(); + await nextTick(); - const sharedAction = wrapper.find(SharedDeleteAction); + const sharedAction = wrapper.find(SharedDeleteAction); - expect(sharedAction.attributes('data-block-user-url')).toBe('/block'); - expect(sharedAction.attributes('data-delete-user-url')).toBe('/delete'); - expect(sharedAction.attributes('data-gl-modal-action')).toBe(kebabCase(action)); - expect(sharedAction.attributes('data-username')).toBe('John Doe'); - expect(sharedAction.attributes('data-oncall-schedules')).toBe( - JSON.stringify(oncallSchedules), - ); - expect(findDropdownItem().exists()).toBe(true); - }); + expect(sharedAction.attributes('data-block-user-url')).toBe(paths.block); + expect(sharedAction.attributes('data-delete-user-url')).toBe(expectedPath); + expect(sharedAction.attributes('data-gl-modal-action')).toBe(kebabCase(action)); + expect(sharedAction.attributes('data-username')).toBe('John Doe'); + expect(sharedAction.attributes('data-oncall-schedules')).toBe( + JSON.stringify(oncallSchedules), + ); + expect(findDropdownItem().exists()).toBe(true); + }, + ); }); }); |