diff options
Diffstat (limited to 'spec/frontend/packages_and_registries/package_registry/components/details/package_title_spec.js')
-rw-r--r-- | spec/frontend/packages_and_registries/package_registry/components/details/package_title_spec.js | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/spec/frontend/packages_and_registries/package_registry/components/details/package_title_spec.js b/spec/frontend/packages_and_registries/package_registry/components/details/package_title_spec.js index d306f7834f0..37416dcd4e7 100644 --- a/spec/frontend/packages_and_registries/package_registry/components/details/package_title_spec.js +++ b/spec/frontend/packages_and_registries/package_registry/components/details/package_title_spec.js @@ -22,16 +22,21 @@ const packageWithTags = { packageFiles: { nodes: packageFiles() }, }; +const defaultProvide = { + isGroupPage: false, +}; + describe('PackageTitle', () => { let wrapper; - async function createComponent(packageEntity = packageWithTags) { + async function createComponent(packageEntity = packageWithTags, provide = defaultProvide) { wrapper = shallowMountExtended(PackageTitle, { propsData: { packageEntity }, stubs: { TitleArea, GlSprintf, }, + provide, directives: { GlResizeObserver: createMockDirective(), }, @@ -199,11 +204,22 @@ describe('PackageTitle', () => { expect(findPipelineProject().exists()).toBe(false); }); - it('correctly shows the pipeline project if there is one', async () => { + it('does not display the pipeline project on project page even if it exists', async () => { await createComponent({ ...packageData(), pipelines: { nodes: packagePipelines() }, }); + expect(findPipelineProject().exists()).toBe(false); + }); + + it('correctly shows the pipeline project on group page if there is one', async () => { + await createComponent( + { + ...packageData(), + pipelines: { nodes: packagePipelines() }, + }, + { isGroupPage: true }, + ); expect(findPipelineProject().props()).toMatchObject({ text: packagePipelines()[0].project.name, icon: 'review-list', |