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

storage_type_help_link_spec.js « components « storage « usage_quotas « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9c855e4bec1daddec6b3b028c93cc94ade36cf88 (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
42
43
44
45
46
47
48
49
import { GlLink } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import StorageTypeHelpLink from '~/usage_quotas/storage/components/storage_type_help_link.vue';
import { storageTypeHelpPaths } from '~/usage_quotas/storage/constants';

let wrapper;

const createComponent = ({ props = {} } = {}) => {
  wrapper = shallowMount(StorageTypeHelpLink, {
    propsData: {
      helpLinks: storageTypeHelpPaths,
      ...props,
    },
  });
};

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

describe('StorageTypeHelpLink', () => {
  describe('Storage type w/ link', () => {
    describe.each(Object.entries(storageTypeHelpPaths))('%s', (storageType, url) => {
      beforeEach(() => {
        createComponent({
          props: {
            storageType,
          },
        });
      });

      it('will have proper href', () => {
        expect(findLink().attributes('href')).toBe(url);
      });
    });
  });

  describe('Storage type w/o help link', () => {
    beforeEach(() => {
      createComponent({
        props: {
          storageType: 'Yellow Submarine',
        },
      });
    });

    it('will not have a href', () => {
      expect(findLink().attributes('href')).toBe(undefined);
    });
  });
});