diff options
Diffstat (limited to 'spec/frontend/usage_quotas')
6 files changed, 39 insertions, 80 deletions
diff --git a/spec/frontend/usage_quotas/components/usage_quotas_app_spec.js b/spec/frontend/usage_quotas/components/usage_quotas_app_spec.js index cb70ea4e72d..3508bf7cfde 100644 --- a/spec/frontend/usage_quotas/components/usage_quotas_app_spec.js +++ b/spec/frontend/usage_quotas/components/usage_quotas_app_spec.js @@ -23,10 +23,6 @@ describe('UsageQuotasApp', () => { createComponent(); }); - afterEach(() => { - wrapper.destroy(); - }); - const findSubTitle = () => wrapper.findByTestId('usage-quotas-page-subtitle'); it('renders the view title', () => { diff --git a/spec/frontend/usage_quotas/storage/components/project_storage_app_spec.js b/spec/frontend/usage_quotas/storage/components/project_storage_app_spec.js index 3379af3f41c..1a200090805 100644 --- a/spec/frontend/usage_quotas/storage/components/project_storage_app_spec.js +++ b/spec/frontend/usage_quotas/storage/components/project_storage_app_spec.js @@ -53,10 +53,6 @@ describe('ProjectStorageApp', () => { const findUsageQuotasHelpLink = () => wrapper.findByTestId('usage-quotas-help-link'); const findUsageGraph = () => wrapper.findComponent(UsageGraph); - afterEach(() => { - wrapper.destroy(); - }); - describe('with apollo fetching successful', () => { let mockApollo; diff --git a/spec/frontend/usage_quotas/storage/components/project_storage_detail_spec.js b/spec/frontend/usage_quotas/storage/components/project_storage_detail_spec.js index ce489f69cad..15758c94436 100644 --- a/spec/frontend/usage_quotas/storage/components/project_storage_detail_spec.js +++ b/spec/frontend/usage_quotas/storage/components/project_storage_detail_spec.js @@ -2,12 +2,7 @@ import { GlTableLite, GlPopover } from '@gitlab/ui'; import { mount } from '@vue/test-utils'; import { extendedWrapper } from 'helpers/vue_test_utils_helper'; import ProjectStorageDetail from '~/usage_quotas/storage/components/project_storage_detail.vue'; -import { - containerRegistryPopoverId, - containerRegistryId, - uploadsPopoverId, - uploadsId, -} from '~/usage_quotas/storage/constants'; +import { containerRegistryPopoverId, containerRegistryId } from '~/usage_quotas/storage/constants'; import { numberToHumanSize } from '~/lib/utils/number_utils'; import { projectData, projectHelpLinks } from '../mock_data'; @@ -47,16 +42,11 @@ describe('ProjectStorageDetail', () => { const findPopoverById = (id) => wrapper.findAllComponents(GlPopover).filter((p) => p.attributes('data-testid') === id); const findContainerRegistryPopover = () => findPopoverById(containerRegistryPopoverId); - const findUploadsPopover = () => findPopoverById(uploadsPopoverId); const findContainerRegistryWarningIcon = () => wrapper.find(`#${containerRegistryPopoverId}`); - const findUploadsWarningIcon = () => wrapper.find(`#${uploadsPopoverId}`); beforeEach(() => { createComponent(); }); - afterEach(() => { - wrapper.destroy(); - }); describe('with storage types', () => { it.each(storageTypes)( @@ -99,31 +89,19 @@ describe('ProjectStorageDetail', () => { }); describe.each` - description | mockStorageTypes | rendersContainerRegistryPopover | rendersUploadsPopover - ${'without any storage type that has popover'} | ${[generateStorageType()]} | ${false} | ${false} - ${'with container registry storage type'} | ${[generateStorageType(containerRegistryId)]} | ${true} | ${false} - ${'with uploads storage type'} | ${[generateStorageType(uploadsId)]} | ${false} | ${true} - ${'with container registry and uploads storage types'} | ${[generateStorageType(containerRegistryId), generateStorageType(uploadsId)]} | ${true} | ${true} - `( - '$description', - ({ mockStorageTypes, rendersContainerRegistryPopover, rendersUploadsPopover }) => { - beforeEach(() => { - createComponent({ storageTypes: mockStorageTypes }); - }); - - it(`does ${ - rendersContainerRegistryPopover ? '' : ' not' - } render container registry warning icon and popover`, () => { - expect(findContainerRegistryWarningIcon().exists()).toBe(rendersContainerRegistryPopover); - expect(findContainerRegistryPopover().exists()).toBe(rendersContainerRegistryPopover); - }); + description | mockStorageTypes | rendersContainerRegistryPopover + ${'without any storage type that has popover'} | ${[generateStorageType()]} | ${false} + ${'with container registry storage type'} | ${[generateStorageType(containerRegistryId)]} | ${true} + `('$description', ({ mockStorageTypes, rendersContainerRegistryPopover }) => { + beforeEach(() => { + createComponent({ storageTypes: mockStorageTypes }); + }); - it(`does ${ - rendersUploadsPopover ? '' : ' not' - } render container registry warning icon and popover`, () => { - expect(findUploadsWarningIcon().exists()).toBe(rendersUploadsPopover); - expect(findUploadsPopover().exists()).toBe(rendersUploadsPopover); - }); - }, - ); + it(`does ${ + rendersContainerRegistryPopover ? '' : ' not' + } render container registry warning icon and popover`, () => { + expect(findContainerRegistryWarningIcon().exists()).toBe(rendersContainerRegistryPopover); + expect(findContainerRegistryPopover().exists()).toBe(rendersContainerRegistryPopover); + }); + }); }); diff --git a/spec/frontend/usage_quotas/storage/components/storage_type_icon_spec.js b/spec/frontend/usage_quotas/storage/components/storage_type_icon_spec.js index 1eb3386bfb8..ebe4c4b7f4e 100644 --- a/spec/frontend/usage_quotas/storage/components/storage_type_icon_spec.js +++ b/spec/frontend/usage_quotas/storage/components/storage_type_icon_spec.js @@ -16,17 +16,12 @@ describe('StorageTypeIcon', () => { const findGlIcon = () => wrapper.findComponent(GlIcon); describe('rendering icon', () => { - afterEach(() => { - wrapper.destroy(); - }); - it.each` expected | provided ${'doc-image'} | ${'lfsObjectsSize'} ${'snippet'} | ${'snippetsSize'} ${'infrastructure-registry'} | ${'repositorySize'} ${'package'} | ${'packagesSize'} - ${'upload'} | ${'uploadsSize'} ${'disk'} | ${'wikiSize'} ${'disk'} | ${'anything-else'} `( diff --git a/spec/frontend/usage_quotas/storage/components/usage_graph_spec.js b/spec/frontend/usage_quotas/storage/components/usage_graph_spec.js index 75b970d937a..2662711076b 100644 --- a/spec/frontend/usage_quotas/storage/components/usage_graph_spec.js +++ b/spec/frontend/usage_quotas/storage/components/usage_graph_spec.js @@ -28,21 +28,16 @@ describe('Storage Counter usage graph component', () => { packagesSize: 3000, containerRegistrySize: 2500, lfsObjectsSize: 2000, - buildArtifactsSize: 500, - pipelineArtifactsSize: 500, + buildArtifactsSize: 700, + pipelineArtifactsSize: 300, snippetsSize: 2000, storageSize: 17000, - uploadsSize: 1000, }, limit: 2000, }; mountComponent(data); }); - afterEach(() => { - wrapper.destroy(); - }); - it('renders the legend in order', () => { const types = wrapper.findAll('[data-testid="storage-type-legend"]'); @@ -55,7 +50,6 @@ describe('Storage Counter usage graph component', () => { repositorySize, wikiSize, snippetsSize, - uploadsSize, } = data.rootStorageStatistics; expect(types.at(0).text()).toMatchInterpolatedText(`Wiki ${numberToHumanSize(wikiSize)}`); @@ -68,16 +62,16 @@ describe('Storage Counter usage graph component', () => { expect(types.at(3).text()).toMatchInterpolatedText( `Container Registry ${numberToHumanSize(containerRegistrySize)}`, ); - expect(types.at(4).text()).toMatchInterpolatedText( - `LFS storage ${numberToHumanSize(lfsObjectsSize)}`, - ); + expect(types.at(4).text()).toMatchInterpolatedText(`LFS ${numberToHumanSize(lfsObjectsSize)}`); expect(types.at(5).text()).toMatchInterpolatedText( `Snippets ${numberToHumanSize(snippetsSize)}`, ); expect(types.at(6).text()).toMatchInterpolatedText( - `Artifacts ${numberToHumanSize(buildArtifactsSize + pipelineArtifactsSize)}`, + `Job artifacts ${numberToHumanSize(buildArtifactsSize)}`, + ); + expect(types.at(7).text()).toMatchInterpolatedText( + `Pipeline artifacts ${numberToHumanSize(pipelineArtifactsSize)}`, ); - expect(types.at(7).text()).toMatchInterpolatedText(`Uploads ${numberToHumanSize(uploadsSize)}`); }); describe('when storage type is not used', () => { @@ -116,8 +110,8 @@ describe('Storage Counter usage graph component', () => { '0.14705882352941177', '0.11764705882352941', '0.11764705882352941', - '0.058823529411764705', - '0.058823529411764705', + '0.041176470588235294', + '0.01764705882352941', ]); }); }); @@ -136,8 +130,8 @@ describe('Storage Counter usage graph component', () => { '0.14705882352941177', '0.11764705882352941', '0.11764705882352941', - '0.058823529411764705', - '0.058823529411764705', + '0.041176470588235294', + '0.01764705882352941', ]); }); }); diff --git a/spec/frontend/usage_quotas/storage/mock_data.js b/spec/frontend/usage_quotas/storage/mock_data.js index b1c6be10d80..b4b02f77b52 100644 --- a/spec/frontend/usage_quotas/storage/mock_data.js +++ b/spec/frontend/usage_quotas/storage/mock_data.js @@ -19,16 +19,25 @@ export const projectData = { { storageType: { id: 'buildArtifactsSize', - name: 'Artifacts', - description: 'Pipeline artifacts and job artifacts, created with CI/CD.', + name: 'Job artifacts', + description: 'Job artifacts created by CI/CD.', helpPath: '/build-artifacts', }, value: 400000, }, { storageType: { + id: 'pipelineArtifactsSize', + name: 'Pipeline artifacts', + description: 'Pipeline artifacts created by CI/CD.', + helpPath: '/pipeline-artifacts', + }, + value: 400000, + }, + { + storageType: { id: 'lfsObjectsSize', - name: 'LFS storage', + name: 'LFS', description: 'Audio samples, videos, datasets, and graphics.', helpPath: '/lsf-objects', }, @@ -63,15 +72,6 @@ export const projectData = { }, { storageType: { - id: 'uploadsSize', - name: 'Uploads', - description: 'File attachments and smaller design graphics.', - helpPath: '/uploads', - }, - value: 900000, - }, - { - storageType: { id: 'wikiSize', name: 'Wiki', description: 'Wiki content.', @@ -87,11 +87,11 @@ export const projectHelpLinks = { containerRegistry: '/container_registry', usageQuotas: '/usage-quotas', buildArtifacts: '/build-artifacts', + pipelineArtifacts: '/pipeline-artifacts', lfsObjects: '/lsf-objects', packages: '/packages', repository: '/repository', snippets: '/snippets', - uploads: '/uploads', wiki: '/wiki', }; |