import { shallowMount } from '@vue/test-utils'; import { GlSprintf } from '@gitlab/ui'; import { nextTick } from 'vue'; import TitleArea from '~/vue_shared/components/registry/title_area.vue'; import HarborListHeader from '~/packages_and_registries/harbor_registry/components/list/harbor_list_header.vue'; import MetadataItem from '~/vue_shared/components/registry/metadata_item.vue'; import { HARBOR_REGISTRY_TITLE, LIST_INTRO_TEXT, } from '~/packages_and_registries/harbor_registry/constants/index'; describe('harbor_list_header', () => { let wrapper; const findTitleArea = () => wrapper.find(TitleArea); const findCommandsSlot = () => wrapper.find('[data-testid="commands-slot"]'); const findImagesMetaDataItem = () => wrapper.find(MetadataItem); const mountComponent = async (propsData, slots) => { wrapper = shallowMount(HarborListHeader, { stubs: { GlSprintf, TitleArea, }, propsData, slots, }); await nextTick(); }; afterEach(() => { wrapper.destroy(); }); describe('header', () => { it('has a title', () => { mountComponent({ metadataLoading: true }); expect(findTitleArea().props()).toMatchObject({ title: HARBOR_REGISTRY_TITLE, metadataLoading: true, }); }); it('has a commands slot', () => { mountComponent(null, { commands: '