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

harbor_list_spec.js « list « components « harbor_registry « packages_and_registries « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e7e74a0da58d7beb701383e022bd3fa73ee6bc97 (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 { shallowMount } from '@vue/test-utils';
import HarborList from '~/packages_and_registries/harbor_registry/components/list/harbor_list.vue';
import HarborListRow from '~/packages_and_registries/harbor_registry/components/list/harbor_list_row.vue';
import RegistryList from '~/packages_and_registries/shared/components/registry_list.vue';
import { harborImagesList } from '../../mock_data';

describe('Harbor List', () => {
  let wrapper;

  const findHarborListRow = () => wrapper.findAllComponents(HarborListRow);

  const mountComponent = (props) => {
    wrapper = shallowMount(HarborList, {
      stubs: { RegistryList },
      propsData: {
        images: harborImagesList,
        pageInfo: {},
        ...props,
      },
    });
  };

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

  describe('list', () => {
    it('contains one list element for each image', () => {
      mountComponent();

      expect(findHarborListRow().length).toBe(harborImagesList.length);
    });

    it('passes down the metadataLoading prop', () => {
      mountComponent({ metadataLoading: true });
      expect(findHarborListRow().at(0).props('metadataLoading')).toBe(true);
    });
  });
});