diff options
Diffstat (limited to 'spec/frontend/vue_shared/components/runner_aws_deployments/runner_aws_deployments_spec.js')
-rw-r--r-- | spec/frontend/vue_shared/components/runner_aws_deployments/runner_aws_deployments_spec.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/spec/frontend/vue_shared/components/runner_aws_deployments/runner_aws_deployments_spec.js b/spec/frontend/vue_shared/components/runner_aws_deployments/runner_aws_deployments_spec.js new file mode 100644 index 00000000000..639668761ea --- /dev/null +++ b/spec/frontend/vue_shared/components/runner_aws_deployments/runner_aws_deployments_spec.js @@ -0,0 +1,41 @@ +import { shallowMount } from '@vue/test-utils'; +import { nextTick } from 'vue'; +import { extendedWrapper } from 'helpers/vue_test_utils_helper'; +import RunnerAwsDeployments from '~/vue_shared/components/runner_aws_deployments/runner_aws_deployments.vue'; +import RunnerAwsDeploymentsModal from '~/vue_shared/components/runner_aws_deployments/runner_aws_deployments_modal.vue'; + +describe('RunnerAwsDeployments component', () => { + let wrapper; + + const findModalButton = () => wrapper.findByTestId('show-modal-button'); + const findModal = () => wrapper.findComponent(RunnerAwsDeploymentsModal); + + const createComponent = () => { + wrapper = extendedWrapper(shallowMount(RunnerAwsDeployments)); + }; + + beforeEach(() => { + createComponent(); + }); + + afterEach(() => { + wrapper.destroy(); + }); + + it('should show the "Deploy GitLab Runner in AWS" button', () => { + expect(findModalButton().exists()).toBe(true); + expect(findModalButton().text()).toBe('Deploy GitLab Runner in AWS'); + }); + + it('should not render the modal once mounted', () => { + expect(findModal().exists()).toBe(false); + }); + + it('should render the modal once clicked', async () => { + findModalButton().vm.$emit('click'); + + await nextTick(); + + expect(findModal().exists()).toBe(true); + }); +}); |