diff options
Diffstat (limited to 'spec/frontend/jobs/components/table/cells/actions_cell_spec.js')
-rw-r--r-- | spec/frontend/jobs/components/table/cells/actions_cell_spec.js | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/spec/frontend/jobs/components/table/cells/actions_cell_spec.js b/spec/frontend/jobs/components/table/cells/actions_cell_spec.js index 1b1e2d4df8f..6caf36e1461 100644 --- a/spec/frontend/jobs/components/table/cells/actions_cell_spec.js +++ b/spec/frontend/jobs/components/table/cells/actions_cell_spec.js @@ -5,7 +5,14 @@ import ActionsCell from '~/jobs/components/table/cells/actions_cell.vue'; import JobPlayMutation from '~/jobs/components/table/graphql/mutations/job_play.mutation.graphql'; import JobRetryMutation from '~/jobs/components/table/graphql/mutations/job_retry.mutation.graphql'; import JobUnscheduleMutation from '~/jobs/components/table/graphql/mutations/job_unschedule.mutation.graphql'; -import { playableJob, retryableJob, scheduledJob } from '../../../mock_data'; +import { + playableJob, + retryableJob, + scheduledJob, + cannotRetryJob, + cannotPlayJob, + cannotPlayScheduledJob, +} from '../../../mock_data'; describe('Job actions cell', () => { let wrapper; @@ -51,6 +58,14 @@ describe('Job actions cell', () => { wrapper.destroy(); }); + it('displays the artifacts download button with correct link', () => { + createComponent(playableJob); + + expect(findDownloadArtifactsButton().attributes('href')).toBe( + playableJob.artifacts.nodes[0].downloadPath, + ); + }); + it('does not display an artifacts download button', () => { createComponent(retryableJob); @@ -58,6 +73,17 @@ describe('Job actions cell', () => { }); it.each` + button | action | jobType + ${findPlayButton} | ${'play'} | ${cannotPlayJob} + ${findRetryButton} | ${'retry'} | ${cannotRetryJob} + ${findPlayScheduledJobButton} | ${'play scheduled'} | ${cannotPlayScheduledJob} + `('does not display the $action button if user cannot update build', ({ button, jobType }) => { + createComponent(jobType); + + expect(button().exists()).toBe(false); + }); + + it.each` button | action | jobType ${findPlayButton} | ${'play'} | ${playableJob} ${findRetryButton} | ${'retry'} | ${retryableJob} |