blob: 639668761ea0d7ad6fc764c1e145a586462bed1b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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);
});
});
|