summaryrefslogtreecommitdiff
path: root/spec/frontend/registry/explorer/components/details_page/empty_tags_state_spec.js
blob: 09afd9d2d8437ae3c00e5104d2d091a15151a166 (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
import { shallowMount } from '@vue/test-utils';
import { GlEmptyState } from '@gitlab/ui';
import component from '~/registry/explorer/components/details_page/empty_tags_state.vue';
import {
  EMPTY_IMAGE_REPOSITORY_TITLE,
  EMPTY_IMAGE_REPOSITORY_MESSAGE,
} from '~/registry/explorer/constants';

describe('EmptyTagsState component', () => {
  let wrapper;

  const findEmptyState = () => wrapper.find(GlEmptyState);

  const mountComponent = () => {
    wrapper = shallowMount(component, {
      stubs: {
        GlEmptyState,
      },
      propsData: {
        noContainersImage: 'foo',
      },
    });
  };

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

  it('contains gl-empty-state', () => {
    mountComponent();
    expect(findEmptyState().exists()).toBe(true);
  });

  it('has the correct props', () => {
    mountComponent();
    expect(findEmptyState().props()).toMatchObject({
      title: EMPTY_IMAGE_REPOSITORY_TITLE,
      description: EMPTY_IMAGE_REPOSITORY_MESSAGE,
      svgPath: 'foo',
    });
  });
});