summaryrefslogtreecommitdiff
path: root/spec/frontend/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_multiversion/setup_instructions_spec.js
blob: 5496cf008c5098c0c8a36971edfc9b82b01fad3e (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
import { shallowMount } from '@vue/test-utils';
import { GlButton, GlLink } from '@gitlab/ui';

import { OAUTH_SELF_MANAGED_DOC_LINK } from '~/jira_connect/subscriptions/constants';
import SetupInstructions from '~/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_multiversion/setup_instructions.vue';

describe('SetupInstructions', () => {
  let wrapper;

  const findGlButton = () => wrapper.findComponent(GlButton);
  const findGlLink = () => wrapper.findComponent(GlLink);

  const createComponent = () => {
    wrapper = shallowMount(SetupInstructions);
  };

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

    it('renders "Learn more" link to documentation', () => {
      expect(findGlLink().attributes('href')).toBe(OAUTH_SELF_MANAGED_DOC_LINK);
    });

    describe('when button is clicked', () => {
      it('emits "next" event', () => {
        expect(wrapper.emitted('next')).toBeUndefined();
        findGlButton().vm.$emit('click');

        expect(wrapper.emitted('next')).toHaveLength(1);
      });
    });
  });
});