summaryrefslogtreecommitdiff
path: root/spec/frontend/pipeline_editor/components/validate/ci_validate_spec.js
blob: 259723175937e8e832688ca1064783792212a9e2 (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
import { GlButton, GlDropdown } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import CiValidate, { i18n } from '~/pipeline_editor/components/validate/ci_validate.vue';

describe('Pipeline Editor Validate Tab', () => {
  let wrapper;

  const createComponent = ({ stubs } = {}) => {
    wrapper = shallowMount(CiValidate, {
      provide: {
        validateTabIllustrationPath: '/path/to/img',
      },
      stubs,
    });
  };

  const findCta = () => wrapper.findComponent(GlButton);
  const findPipelineSource = () => wrapper.findComponent(GlDropdown);

  afterEach(() => {
    wrapper.destroy();
  });

  describe('template', () => {
    beforeEach(() => {
      createComponent();
    });

    it('renders disabled pipeline source dropdown', () => {
      expect(findPipelineSource().exists()).toBe(true);
      expect(findPipelineSource().attributes('text')).toBe(i18n.pipelineSourceDefault);
      expect(findPipelineSource().attributes('disabled')).toBe('true');
    });

    it('renders CTA', () => {
      expect(findCta().exists()).toBe(true);
      expect(findCta().text()).toBe(i18n.cta);
    });
  });
});