diff options
Diffstat (limited to 'spec/frontend/packages_and_registries/container_registry/explorer/components/list_page/cleanup_status_spec.js')
-rw-r--r-- | spec/frontend/packages_and_registries/container_registry/explorer/components/list_page/cleanup_status_spec.js | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/spec/frontend/packages_and_registries/container_registry/explorer/components/list_page/cleanup_status_spec.js b/spec/frontend/packages_and_registries/container_registry/explorer/components/list_page/cleanup_status_spec.js index af5723267f4..0581a40b6a2 100644 --- a/spec/frontend/packages_and_registries/container_registry/explorer/components/list_page/cleanup_status_spec.js +++ b/spec/frontend/packages_and_registries/container_registry/explorer/components/list_page/cleanup_status_spec.js @@ -1,4 +1,4 @@ -import { GlLink, GlPopover, GlSprintf } from '@gitlab/ui'; +import { GlIcon, GlLink, GlPopover, GlSprintf } from '@gitlab/ui'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import { helpPagePath } from '~/helpers/help_page_helper'; import CleanupStatus from '~/packages_and_registries/container_registry/explorer/components/list_page/cleanup_status.vue'; @@ -16,6 +16,7 @@ describe('cleanup_status', () => { let wrapper; const findMainIcon = () => wrapper.findByTestId('main-icon'); + const findMainIconName = () => wrapper.findByTestId('main-icon').find(GlIcon); const findExtraInfoIcon = () => wrapper.findByTestId('extra-info'); const findPopover = () => wrapper.findComponent(GlPopover); @@ -61,6 +62,23 @@ describe('cleanup_status', () => { expect(findMainIcon().exists()).toBe(true); }); + + it.each` + status | visible | iconName + ${UNFINISHED_STATUS} | ${true} | ${'expire'} + ${SCHEDULED_STATUS} | ${true} | ${'clock'} + ${ONGOING_STATUS} | ${true} | ${'clock'} + ${UNSCHEDULED_STATUS} | ${false} | ${''} + `('matches "$iconName" when the status is "$status"', ({ status, visible, iconName }) => { + mountComponent({ status }); + + expect(findMainIcon().exists()).toBe(visible); + if (visible) { + const actualIcon = findMainIconName(); + expect(actualIcon.exists()).toBe(true); + expect(actualIcon.props('name')).toBe(iconName); + } + }); }); describe('extra info icon', () => { |