diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-30 21:10:36 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-30 21:10:36 +0300 |
commit | 316acdcc1ccc1cc85120e1b559b66c34ace6a312 (patch) | |
tree | 0b993c07d3484f333805e2dd0f2e06013a96b580 /spec/frontend/packages_and_registries/package_registry | |
parent | 3b28c7e3b25265042fdac8ea83d5fb960eb345b2 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/packages_and_registries/package_registry')
3 files changed, 56 insertions, 43 deletions
diff --git a/spec/frontend/packages_and_registries/package_registry/components/list/__snapshots__/package_list_row_spec.js.snap b/spec/frontend/packages_and_registries/package_registry/components/list/__snapshots__/package_list_row_spec.js.snap index c647230bc5f..0443fb85dc9 100644 --- a/spec/frontend/packages_and_registries/package_registry/components/list/__snapshots__/package_list_row_spec.js.snap +++ b/spec/frontend/packages_and_registries/package_registry/components/list/__snapshots__/package_list_row_spec.js.snap @@ -64,16 +64,12 @@ exports[`packages_list_row renders 1`] = ` withtooltip="true" /> - <!----> - <span class="gl-ml-2" data-testid="package-type" > ยท npm </span> - - <!----> </div> </div> </div> @@ -91,15 +87,16 @@ exports[`packages_list_row renders 1`] = ` class="gl-display-flex gl-align-items-center gl-min-h-6" > <span - data-testid="created-date" + data-testid="right-secondary" > - Created - <timeago-tooltip-stub - cssclass="" - datetimeformat="DATE_WITH_TIME_FORMAT" - time="2020-08-17T14:23:32Z" - tooltipplacement="top" - /> + Published + <time + class="" + datetime="2020-05-17T14:23:32Z" + title="May 17, 2020 2:23pm UTC" + > + 1 month ago + </time> </span> </div> </div> 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 81ad47b1e13..7a96ddc7afc 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 @@ -5,9 +5,7 @@ import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import { createMockDirective, getBinding } from 'helpers/vue_mock_directive'; import { getIdFromGraphQLId } from '~/graphql_shared/utils'; - import PackagesListRow from '~/packages_and_registries/package_registry/components/list/package_list_row.vue'; -import PackagePath from '~/packages_and_registries/shared/components/package_path.vue'; import PackageTags from '~/packages_and_registries/shared/components/package_tags.vue'; import PublishMethod from '~/packages_and_registries/package_registry/components/list/publish_method.vue'; import TimeagoTooltip from '~/vue_shared/components/time_ago_tooltip.vue'; @@ -36,7 +34,6 @@ describe('packages_list_row', () => { const packageCannotDestroy = { ...packageData(), ...linksData, canDestroy: false }; const findPackageTags = () => wrapper.findComponent(PackageTags); - const findPackagePath = () => wrapper.findComponent(PackagePath); const findDeleteDropdown = () => wrapper.findByTestId('action-delete'); const findPackageType = () => wrapper.findByTestId('package-type'); const findPackageLink = () => wrapper.findByTestId('details-link'); @@ -44,8 +41,7 @@ describe('packages_list_row', () => { const findLeftSecondaryInfos = () => wrapper.findByTestId('left-secondary-infos'); const findPackageVersion = () => findLeftSecondaryInfos().findComponent(GlTruncate); const findPublishMethod = () => wrapper.findComponent(PublishMethod); - const findCreatedDateText = () => wrapper.findByTestId('created-date'); - const findTimeAgoTooltip = () => wrapper.findComponent(TimeagoTooltip); + const findRightSecondary = () => wrapper.findByTestId('right-secondary'); const findListItem = () => wrapper.findComponent(ListItem); const findBulkDeleteAction = () => wrapper.findComponent(GlFormCheckbox); const findPackageName = () => wrapper.findComponent(GlTruncate); @@ -60,6 +56,7 @@ describe('packages_list_row', () => { stubs: { ListItem, GlSprintf, + TimeagoTooltip, }, propsData: { packageEntity, @@ -106,15 +103,6 @@ describe('packages_list_row', () => { }); }); - describe('when it is group', () => { - it('has a package path component', () => { - mountComponent({ provide: { isGroupPage: true } }); - - expect(findPackagePath().exists()).toBe(true); - expect(findPackagePath().props()).toMatchObject({ path: 'gitlab-org/gitlab-test' }); - }); - }); - describe('delete button', () => { it('does not exist when package cannot be destroyed', () => { mountComponent({ packageEntity: packageCannotDestroy }); @@ -223,14 +211,6 @@ describe('packages_list_row', () => { }); }); - it('if the pipeline exists show the author message', () => { - mountComponent({ - packageEntity: { ...packageWithoutTags, pipelines: { nodes: packagePipelines() } }, - }); - - expect(findLeftSecondaryInfos().text()).toContain('published by Administrator'); - }); - it('has package type with middot', () => { mountComponent(); @@ -247,13 +227,48 @@ describe('packages_list_row', () => { expect(findPublishMethod().props('pipeline')).toEqual(packagePipelines()[0]); }); - it('has the created date', () => { - mountComponent(); + it('if the package is published through CI show the author name', () => { + mountComponent({ + packageEntity: { ...packageWithoutTags, pipelines: { nodes: packagePipelines() } }, + }); + + expect(findRightSecondary().text()).toBe(`Published by Administrator, 1 month ago`); + }); - expect(findCreatedDateText().text()).toMatchInterpolatedText(PackagesListRow.i18n.createdAt); - expect(findTimeAgoTooltip().props()).toMatchObject({ - time: packageData().createdAt, + it('if the package is published manually then dont show author name', () => { + mountComponent({ + packageEntity: { ...packageWithoutTags }, + }); + + expect(findRightSecondary().text()).toBe(`Published 1 month ago`); + }); + }); + + describe('right info for a group registry', () => { + it('if the package is published through CI show the project and author name', () => { + mountComponent({ + provide: { + isGroupPage: true, + }, + packageEntity: { ...packageWithoutTags, pipelines: { nodes: packagePipelines() } }, + }); + + expect(findRightSecondary().text()).toBe( + `Published to ${packageWithoutTags.project.name} by Administrator, 1 month ago`, + ); + }); + + it('if the package is published manually dont show project and the author name', () => { + mountComponent({ + provide: { + isGroupPage: true, + }, + packageEntity: { ...packageWithoutTags }, }); + + expect(findRightSecondary().text()).toBe( + `Published to ${packageWithoutTags.project.name}, 1 month ago`, + ); }); }); }); diff --git a/spec/frontend/packages_and_registries/package_registry/mock_data.js b/spec/frontend/packages_and_registries/package_registry/mock_data.js index 11539b925b6..91dc02f8f39 100644 --- a/spec/frontend/packages_and_registries/package_registry/mock_data.js +++ b/spec/frontend/packages_and_registries/package_registry/mock_data.js @@ -9,7 +9,7 @@ export const packageTags = () => [ export const packagePipelines = (extend) => [ { commitPath: '/namespace14/project14/-/commit/b83d6e391c22777fca1ed3012fce84f633d7fed0', - createdAt: '2020-08-17T14:23:32Z', + createdAt: '2020-05-17T14:23:32Z', id: 'gid://gitlab/Ci::Pipeline/36', path: '/namespace14/project14/-/pipelines/36', name: 'project14', @@ -38,7 +38,7 @@ export const packageFiles = () => [ fileSha1: 'be93151dc23ac34a82752444556fe79b32c7a1ad', fileSha256: 'fileSha256', size: '409600', - createdAt: '2020-08-17T14:23:32Z', + createdAt: '2020-05-17T14:23:32Z', downloadPath: 'downloadPath', __typename: 'PackageFile', }, @@ -49,7 +49,7 @@ export const packageFiles = () => [ fileSha1: 'be93151dc23ac34a82752444556fe79b32c7a1ss', fileSha256: null, size: '409600', - createdAt: '2020-08-17T14:23:32Z', + createdAt: '2020-05-17T14:23:32Z', downloadPath: 'downloadPath', __typename: 'PackageFile', }, @@ -92,6 +92,7 @@ export const dependencyLinks = () => [ export const packageProject = () => ({ id: '1', + name: 'gitlab-test', fullPath: 'gitlab-org/gitlab-test', webUrl: 'http://gdk.test:3000/gitlab-org/gitlab-test', __typename: 'Project', @@ -144,7 +145,7 @@ export const packageData = (extend) => ({ name: '@gitlab-org/package-15', packageType: 'NPM', version: '1.0.0', - createdAt: '2020-08-17T14:23:32Z', + createdAt: '2020-05-17T14:23:32Z', updatedAt: '2020-08-17T14:23:32Z', lastDownloadedAt: '2021-08-17T14:23:32Z', status: 'DEFAULT', |