diff options
Diffstat (limited to 'spec/frontend/packages_and_registries/package_registry/components')
3 files changed, 35 insertions, 7 deletions
diff --git a/spec/frontend/packages_and_registries/package_registry/components/details/__snapshots__/pypi_installation_spec.js.snap b/spec/frontend/packages_and_registries/package_registry/components/details/__snapshots__/pypi_installation_spec.js.snap index 92c2cd90568..c4020eeb75f 100644 --- a/spec/frontend/packages_and_registries/package_registry/components/details/__snapshots__/pypi_installation_spec.js.snap +++ b/spec/frontend/packages_and_registries/package_registry/components/details/__snapshots__/pypi_installation_spec.js.snap @@ -13,7 +13,7 @@ exports[`PypiInstallation renders all the messages 1`] = ` <div> <div - class="dropdown b-dropdown gl-new-dropdown btn-group" + class="dropdown b-dropdown gl-dropdown btn-group" id="__BVID__27" lazy="" > @@ -30,7 +30,7 @@ exports[`PypiInstallation renders all the messages 1`] = ` <!----> <span - class="gl-new-dropdown-button-text" + class="gl-dropdown-button-text" > Show PyPi commands </span> diff --git a/spec/frontend/packages_and_registries/package_registry/components/list/package_list_row_spec.js b/spec/frontend/packages_and_registries/package_registry/components/list/package_list_row_spec.js index 913b4f5926f..bb04701a8b7 100644 --- a/spec/frontend/packages_and_registries/package_registry/components/list/package_list_row_spec.js +++ b/spec/frontend/packages_and_registries/package_registry/components/list/package_list_row_spec.js @@ -1,4 +1,4 @@ -import { GlFormCheckbox, GlSprintf } from '@gitlab/ui'; +import { GlFormCheckbox, GlSprintf, GlTruncate } from '@gitlab/ui'; import Vue, { nextTick } from 'vue'; import VueRouter from 'vue-router'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; @@ -15,7 +15,13 @@ import TimeagoTooltip from '~/vue_shared/components/time_ago_tooltip.vue'; import { PACKAGE_ERROR_STATUS } from '~/packages_and_registries/package_registry/constants'; import ListItem from '~/vue_shared/components/registry/list_item.vue'; -import { packageData, packagePipelines, packageProject, packageTags } from '../../mock_data'; +import { + linksData, + packageData, + packagePipelines, + packageProject, + packageTags, +} from '../../mock_data'; Vue.use(VueRouter); @@ -26,9 +32,9 @@ describe('packages_list_row', () => { isGroupPage: false, }; - const packageWithoutTags = { ...packageData(), project: packageProject() }; + const packageWithoutTags = { ...packageData(), project: packageProject(), ...linksData }; const packageWithTags = { ...packageWithoutTags, tags: { nodes: packageTags() } }; - const packageCannotDestroy = { ...packageData(), canDestroy: false }; + const packageCannotDestroy = { ...packageData(), ...linksData, canDestroy: false }; const findPackageTags = () => wrapper.findComponent(PackageTags); const findPackagePath = () => wrapper.findComponent(PackagePath); @@ -41,6 +47,7 @@ describe('packages_list_row', () => { const findCreatedDateText = () => wrapper.findByTestId('created-date'); const findTimeAgoTooltip = () => wrapper.findComponent(TimeagoTooltip); const findBulkDeleteAction = () => wrapper.findComponent(GlFormCheckbox); + const findPackageName = () => wrapper.findComponent(GlTruncate); const mountComponent = ({ packageEntity = packageWithoutTags, @@ -81,6 +88,22 @@ describe('packages_list_row', () => { }); }); + it('does not have a link to navigate to the details page', () => { + mountComponent({ + packageEntity: { + ...packageWithoutTags, + _links: { + webPath: null, + }, + }, + }); + + expect(findPackageLink().exists()).toBe(false); + expect(findPackageName().props()).toMatchObject({ + text: '@gitlab-org/package-15', + }); + }); + describe('tags', () => { it('renders package tags when a package has tags', () => { mountComponent({ packageEntity: packageWithTags }); diff --git a/spec/frontend/packages_and_registries/package_registry/components/list/packages_search_spec.js b/spec/frontend/packages_and_registries/package_registry/components/list/packages_search_spec.js index 19505618ff7..a884959ab62 100644 --- a/spec/frontend/packages_and_registries/package_registry/components/list/packages_search_spec.js +++ b/spec/frontend/packages_and_registries/package_registry/components/list/packages_search_spec.js @@ -10,6 +10,7 @@ import { useMockLocationHelper } from 'helpers/mock_window_location_helper'; import { LIST_KEY_CREATED_AT } from '~/packages_and_registries/package_registry/constants'; import { getQueryParams, extractFilterAndSorting } from '~/packages_and_registries/shared/utils'; +import { TOKEN_TYPE_TYPE } from '~/vue_shared/components/filtered_search_bar/constants'; jest.mock('~/packages_and_registries/shared/utils'); @@ -92,7 +93,11 @@ describe('Package Search', () => { expect(findRegistrySearch().props()).toMatchObject({ tokens: expect.arrayContaining([ - expect.objectContaining({ token: PackageTypeToken, type: 'type', icon: 'package' }), + expect.objectContaining({ + token: PackageTypeToken, + type: TOKEN_TYPE_TYPE, + icon: 'package', + }), ]), sortableFields: sortableFields(isGroupPage), }); |