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

empty_state_spec.js « environment_details « environments « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: aaf597d68edcc1bf0038245dd2dd59a433628299 (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
import { GlEmptyState } from '@gitlab/ui';
import { mountExtended } from 'helpers/vue_test_utils_helper';
import EmptyState from '~/environments/environment_details/empty_state.vue';
import {
  translations,
  environmentsHelpPagePath,
  codeBlockPlaceholders,
} from '~/environments/environment_details/constants';

describe('~/environments/environment_details/empty_state.vue', () => {
  let wrapper;

  const createWrapper = () => {
    return mountExtended(EmptyState);
  };

  describe('when Empty State is rendered for environment details page', () => {
    beforeEach(() => {
      wrapper = createWrapper();
    });

    it('should render the proper title', () => {
      expect(wrapper.text()).toContain(translations.emptyStateTitle);
    });

    it('should render GlEmptyState component with correct props', () => {
      const glEmptyStateComponent = wrapper.findComponent(GlEmptyState);
      expect(glEmptyStateComponent.props().primaryButtonText).toBe(
        translations.emptyStatePrimaryButton,
      );
      expect(glEmptyStateComponent.props().primaryButtonLink).toBe(environmentsHelpPagePath);
    });

    it('should render formatted description', () => {
      expect(wrapper.text()).not.toContain(codeBlockPlaceholders.code[0]);
      expect(wrapper.text()).not.toContain(codeBlockPlaceholders.code[1]);
    });
  });
});