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

storage_type_icon_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: 1eb3386bfb850c2d169e4541142578a6281be157 (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 { mount } from '@vue/test-utils';
import { GlIcon } from '@gitlab/ui';
import StorageTypeIcon from '~/usage_quotas/storage/components/storage_type_icon.vue';

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

  const createComponent = (props = {}) => {
    wrapper = mount(StorageTypeIcon, {
      propsData: {
        ...props,
      },
    });
  };

  const findGlIcon = () => wrapper.findComponent(GlIcon);

  describe('rendering icon', () => {
    afterEach(() => {
      wrapper.destroy();
    });

    it.each`
      expected                     | provided
      ${'doc-image'}               | ${'lfsObjectsSize'}
      ${'snippet'}                 | ${'snippetsSize'}
      ${'infrastructure-registry'} | ${'repositorySize'}
      ${'package'}                 | ${'packagesSize'}
      ${'upload'}                  | ${'uploadsSize'}
      ${'disk'}                    | ${'wikiSize'}
      ${'disk'}                    | ${'anything-else'}
    `(
      'renders icon with name of $expected when name prop is $provided',
      ({ expected, provided }) => {
        createComponent({ name: provided });

        expect(findGlIcon().props('name')).toBe(expected);
      },
    );
  });
});