diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
commit | 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch) | |
tree | 544930fb309b30317ae9797a9683768705d664c4 /spec/frontend/registry/explorer/components/list_page/cli_commands_spec.js | |
parent | 4b1de649d0168371549608993deac953eb692019 (diff) |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'spec/frontend/registry/explorer/components/list_page/cli_commands_spec.js')
-rw-r--r-- | spec/frontend/registry/explorer/components/list_page/cli_commands_spec.js | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/spec/frontend/registry/explorer/components/list_page/cli_commands_spec.js b/spec/frontend/registry/explorer/components/list_page/cli_commands_spec.js index 551d1eee68d..74b9ea5fd96 100644 --- a/spec/frontend/registry/explorer/components/list_page/cli_commands_spec.js +++ b/spec/frontend/registry/explorer/components/list_page/cli_commands_spec.js @@ -2,10 +2,8 @@ import Vuex from 'vuex'; import { mount, createLocalVue } from '@vue/test-utils'; import { GlDropdown } from '@gitlab/ui'; import Tracking from '~/tracking'; -import * as getters from '~/registry/explorer/stores/getters'; import QuickstartDropdown from '~/registry/explorer/components/list_page/cli_commands.vue'; import CodeInstruction from '~/vue_shared/components/registry/code_instruction.vue'; - import { QUICK_START, LOGIN_COMMAND_LABEL, @@ -14,31 +12,33 @@ import { COPY_BUILD_TITLE, PUSH_COMMAND_LABEL, COPY_PUSH_TITLE, -} from '~/registry/explorer//constants'; +} from '~/registry/explorer/constants'; + +import { dockerCommands } from '../../mock_data'; const localVue = createLocalVue(); localVue.use(Vuex); describe('cli_commands', () => { let wrapper; - let store; + + const config = { + repositoryUrl: 'foo', + registryHostUrlWithPort: 'bar', + }; const findDropdownButton = () => wrapper.find(GlDropdown); const findCodeInstruction = () => wrapper.findAll(CodeInstruction); const mountComponent = () => { - store = new Vuex.Store({ - state: { - config: { - repositoryUrl: 'foo', - registryHostUrlWithPort: 'bar', - }, - }, - getters, - }); wrapper = mount(QuickstartDropdown, { localVue, - store, + provide() { + return { + config, + ...dockerCommands, + }; + }, }); }; @@ -50,7 +50,6 @@ describe('cli_commands', () => { afterEach(() => { wrapper.destroy(); wrapper = null; - store = null; }); it('shows the correct text on the button', () => { @@ -67,11 +66,11 @@ describe('cli_commands', () => { }); describe.each` - index | labelText | titleText | getter | trackedEvent - ${0} | ${LOGIN_COMMAND_LABEL} | ${COPY_LOGIN_TITLE} | ${'dockerLoginCommand'} | ${'click_copy_login'} - ${1} | ${BUILD_COMMAND_LABEL} | ${COPY_BUILD_TITLE} | ${'dockerBuildCommand'} | ${'click_copy_build'} - ${2} | ${PUSH_COMMAND_LABEL} | ${COPY_PUSH_TITLE} | ${'dockerPushCommand'} | ${'click_copy_push'} - `('code instructions at $index', ({ index, labelText, titleText, getter, trackedEvent }) => { + index | labelText | titleText | command | trackedEvent + ${0} | ${LOGIN_COMMAND_LABEL} | ${COPY_LOGIN_TITLE} | ${dockerCommands.dockerLoginCommand} | ${'click_copy_login'} + ${1} | ${BUILD_COMMAND_LABEL} | ${COPY_BUILD_TITLE} | ${dockerCommands.dockerBuildCommand} | ${'click_copy_build'} + ${2} | ${PUSH_COMMAND_LABEL} | ${COPY_PUSH_TITLE} | ${dockerCommands.dockerPushCommand} | ${'click_copy_push'} + `('code instructions at $index', ({ index, labelText, titleText, command, trackedEvent }) => { let codeInstruction; beforeEach(() => { @@ -85,7 +84,7 @@ describe('cli_commands', () => { it(`has the correct props`, () => { expect(codeInstruction.props()).toMatchObject({ label: labelText, - instruction: store.getters[getter], + instruction: command, copyText: titleText, trackingAction: trackedEvent, trackingLabel: 'quickstart_dropdown', |