Welcome to mirror list, hosted at ThFree Co, Russian Federation.

unmet_prerequisites_block_spec.js « job « components « jobs « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: fb7d389c4d64390b6ee1ba0370a70846b4e25359 (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 { GlAlert, GlLink } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import UnmetPrerequisitesBlock from '~/jobs/components/job/unmet_prerequisites_block.vue';

describe('Unmet Prerequisites Block Job component', () => {
  let wrapper;
  const helpPath = '/user/project/clusters/index.html#troubleshooting-failed-deployment-jobs';

  const createComponent = () => {
    wrapper = shallowMount(UnmetPrerequisitesBlock, {
      propsData: {
        helpPath,
      },
    });
  };

  beforeEach(() => {
    createComponent();
  });

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

  it('renders an alert with the correct message', () => {
    const container = wrapper.findComponent(GlAlert);
    const alertMessage =
      'This job failed because the necessary resources were not successfully created.';

    expect(container).not.toBeNull();
    expect(container.text()).toContain(alertMessage);
  });

  it('renders link to help page', () => {
    const helpLink = wrapper.findComponent(GlLink);

    expect(helpLink).not.toBeNull();
    expect(helpLink.text()).toContain('More information');
    expect(helpLink.attributes().href).toEqual(helpPath);
  });
});