summaryrefslogtreecommitdiff
path: root/spec/frontend/packages_and_registries/shared/package_icon_and_name_spec.js
blob: d6d1970cb12049fc8759722ca3595e4dbb49f58d (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
import { GlIcon } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import PackageIconAndName from '~/packages_and_registries/shared/components/package_icon_and_name.vue';

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

  const findIcon = () => wrapper.find(GlIcon);

  const mountComponent = () => {
    wrapper = shallowMount(PackageIconAndName, {
      slots: {
        default: 'test',
      },
    });
  };

  it('has an icon', () => {
    mountComponent();

    const icon = findIcon();

    expect(icon.exists()).toBe(true);
    expect(icon.props('name')).toBe('package');
  });

  it('renders the slot content', () => {
    mountComponent();

    expect(wrapper.text()).toBe('test');
  });
});