summaryrefslogtreecommitdiff
path: root/spec/frontend/registry/explorer/components/details_page/details_header_spec.js
blob: fc93e9094c9b4ea87ed24ae9e233fdf593066a2d (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
import { shallowMount } from '@vue/test-utils';
import { GlSprintf } from '@gitlab/ui';
import TitleArea from '~/vue_shared/components/registry/title_area.vue';
import component from '~/registry/explorer/components/details_page/details_header.vue';
import { DETAILS_PAGE_TITLE } from '~/registry/explorer/constants';

describe('Details Header', () => {
  let wrapper;

  const mountComponent = propsData => {
    wrapper = shallowMount(component, {
      propsData,
      stubs: {
        GlSprintf,
        TitleArea,
      },
    });
  };

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

  it('has the correct title ', () => {
    mountComponent();
    expect(wrapper.text()).toMatchInterpolatedText(DETAILS_PAGE_TITLE);
  });

  it('shows imageName in the title', () => {
    mountComponent({ imageName: 'foo' });
    expect(wrapper.text()).toContain('foo');
  });
});