diff options
Diffstat (limited to 'spec/frontend/ci/runner/components/cells')
-rw-r--r-- | spec/frontend/ci/runner/components/cells/runner_summary_cell_spec.js (renamed from spec/frontend/ci/runner/components/cells/runner_stacked_summary_cell_spec.js) | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/spec/frontend/ci/runner/components/cells/runner_stacked_summary_cell_spec.js b/spec/frontend/ci/runner/components/cells/runner_summary_cell_spec.js index 4aa354f9b62..10280c77303 100644 --- a/spec/frontend/ci/runner/components/cells/runner_stacked_summary_cell_spec.js +++ b/spec/frontend/ci/runner/components/cells/runner_summary_cell_spec.js @@ -1,12 +1,18 @@ import { __ } from '~/locale'; import { mountExtended } from 'helpers/vue_test_utils_helper'; -import RunnerStackedSummaryCell from '~/ci/runner/components/cells/runner_stacked_summary_cell.vue'; +import RunnerSummaryCell from '~/ci/runner/components/cells/runner_summary_cell.vue'; import TimeAgo from '~/vue_shared/components/time_ago_tooltip.vue'; import RunnerTags from '~/ci/runner/components/runner_tags.vue'; +import RunnerJobStatusBadge from '~/ci/runner/components/runner_job_status_badge.vue'; import RunnerSummaryField from '~/ci/runner/components/cells/runner_summary_field.vue'; import { getIdFromGraphQLId } from '~/graphql_shared/utils'; -import { INSTANCE_TYPE, I18N_INSTANCE_TYPE, PROJECT_TYPE } from '~/ci/runner/constants'; +import { + INSTANCE_TYPE, + I18N_INSTANCE_TYPE, + PROJECT_TYPE, + I18N_NO_DESCRIPTION, +} from '~/ci/runner/constants'; import { allRunnersData } from '../../mock_data'; @@ -16,13 +22,14 @@ describe('RunnerTypeCell', () => { let wrapper; const findLockIcon = () => wrapper.findByTestId('lock-icon'); + const findRunnerJobStatusBadge = () => wrapper.findComponent(RunnerJobStatusBadge); const findRunnerTags = () => wrapper.findComponent(RunnerTags); const findRunnerSummaryField = (icon) => wrapper.findAllComponents(RunnerSummaryField).filter((w) => w.props('icon') === icon) .wrappers[0]; const createComponent = (runner, options) => { - wrapper = mountExtended(RunnerStackedSummaryCell, { + wrapper = mountExtended(RunnerSummaryCell, { propsData: { runner: { ...mockRunner, @@ -80,6 +87,18 @@ describe('RunnerTypeCell', () => { expect(wrapper.text()).toContain(mockRunner.description); }); + it('Displays the no runner description', () => { + createComponent({ + description: null, + }); + + expect(wrapper.text()).toContain(I18N_NO_DESCRIPTION); + }); + + it('Displays job execution status', () => { + expect(findRunnerJobStatusBadge().props('jobStatus')).toBe(mockRunner.jobExecutionStatus); + }); + it('Displays last contact', () => { createComponent({ contactedAt: '2022-01-02', @@ -147,14 +166,14 @@ describe('RunnerTypeCell', () => { expect(findRunnerTags().props('tagList')).toEqual(['shell', 'linux']); }); - it('Displays a custom slot', () => { + it.each(['runner-name', 'runner-job-status-badge'])('Displays a custom "%s" slot', (slotName) => { const slotContent = 'My custom runner name'; createComponent( {}, { slots: { - 'runner-name': slotContent, + [slotName]: slotContent, }, }, ); |