diff options
Diffstat (limited to 'spec/frontend/registry/explorer/pages/details_spec.js')
-rw-r--r-- | spec/frontend/registry/explorer/pages/details_spec.js | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/spec/frontend/registry/explorer/pages/details_spec.js b/spec/frontend/registry/explorer/pages/details_spec.js index d307dfe590c..1746a6a63b6 100644 --- a/spec/frontend/registry/explorer/pages/details_spec.js +++ b/spec/frontend/registry/explorer/pages/details_spec.js @@ -1,7 +1,7 @@ import { shallowMount, createLocalVue } from '@vue/test-utils'; import { GlKeysetPagination } from '@gitlab/ui'; import VueApollo from 'vue-apollo'; -import createMockApollo from 'jest/helpers/mock_apollo_helper'; +import createMockApollo from 'helpers/mock_apollo_helper'; import waitForPromises from 'helpers/wait_for_promises'; import Tracking from '~/tracking'; import component from '~/registry/explorer/pages/details.vue'; @@ -15,6 +15,8 @@ import EmptyTagsState from '~/registry/explorer/components/details_page/empty_ta import getContainerRepositoryDetailsQuery from '~/registry/explorer/graphql/queries/get_container_repository_details.query.graphql'; import deleteContainerRepositoryTagsMutation from '~/registry/explorer/graphql/mutations/delete_container_repository_tags.mutation.graphql'; +import { UNFINISHED_STATUS } from '~/registry/explorer/constants/index'; + import { graphQLImageDetailsMock, graphQLImageDetailsEmptyTagsMock, @@ -46,7 +48,7 @@ describe('Details Page', () => { updateName: jest.fn(), }; - const cleanTags = tagsMock.map(t => { + const cleanTags = tagsMock.map((t) => { const result = { ...t }; // eslint-disable-next-line no-underscore-dangle delete result.__typename; @@ -58,7 +60,7 @@ describe('Details Page', () => { await wrapper.vm.$nextTick(); }; - const tagsArrayToSelectedTags = tags => + const tagsArrayToSelectedTags = (tags) => tags.reduce((acc, c) => { acc[c.name] = true; return acc; @@ -334,7 +336,7 @@ describe('Details Page', () => { findDeleteModal().vm.$emit('confirmDelete'); expect(mutationResolver).toHaveBeenCalledWith( - expect.objectContaining({ tagNames: tagsMock.map(t => t.name) }), + expect.objectContaining({ tagNames: tagsMock.map((t) => t.name) }), ); }); }); @@ -353,10 +355,13 @@ describe('Details Page', () => { mountComponent(); await waitForApolloRequestRender(); - expect(findDetailsHeader().props('image')).toMatchObject({ - name: containerRepositoryMock.name, - project: { - visibility: containerRepositoryMock.project.visibility, + expect(findDetailsHeader().props()).toMatchObject({ + metadataLoading: false, + image: { + name: containerRepositoryMock.name, + project: { + visibility: containerRepositoryMock.project.visibility, + }, }, }); }); @@ -398,13 +403,13 @@ describe('Details Page', () => { cleanupPoliciesHelpPagePath: 'bar', }; - describe('when expiration_policy_started is not null', () => { + describe(`when expirationPolicyCleanupStatus is ${UNFINISHED_STATUS}`, () => { let resolver; beforeEach(() => { resolver = jest.fn().mockResolvedValue( graphQLImageDetailsMock({ - expirationPolicyStartedAt: Date.now().toString(), + expirationPolicyCleanupStatus: UNFINISHED_STATUS, }), ); }); @@ -439,7 +444,7 @@ describe('Details Page', () => { }); }); - describe('when expiration_policy_started is null', () => { + describe(`when expirationPolicyCleanupStatus is not ${UNFINISHED_STATUS}`, () => { it('the component is hidden', async () => { mountComponent(); await waitForApolloRequestRender(); |