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

pipeline_schedules_empty_state_spec.js « components « pipeline_schedules « ci « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5ad0f915f622d5da461ac4d27d544362dd6b685e (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
import { shallowMount } from '@vue/test-utils';
import { GlEmptyState, GlLink, GlSprintf } from '@gitlab/ui';
import PipelineSchedulesEmptyState from '~/ci/pipeline_schedules/components/pipeline_schedules_empty_state.vue';

describe('Pipeline Schedules Empty State', () => {
  let wrapper;

  const mockSchedulePath = 'root/test/-/pipeline_schedules/new"';

  const createComponent = () => {
    wrapper = shallowMount(PipelineSchedulesEmptyState, {
      provide: {
        newSchedulePath: mockSchedulePath,
      },
      stubs: { GlSprintf },
    });
  };

  const findEmptyState = () => wrapper.findComponent(GlEmptyState);
  const findLink = () => wrapper.findComponent(GlLink);

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

  it('shows empty state', () => {
    expect(findEmptyState().exists()).toBe(true);
  });

  it('has link to create new schedule', () => {
    expect(findEmptyState().props('primaryButtonLink')).toBe(mockSchedulePath);
  });

  it('has link to help documentation', () => {
    expect(findLink().attributes('href')).toBe('/help/ci/pipelines/schedules');
  });
});