diff options
Diffstat (limited to 'spec/frontend/jobs/components/job/unmet_prerequisites_block_spec.js')
-rw-r--r-- | spec/frontend/jobs/components/job/unmet_prerequisites_block_spec.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/spec/frontend/jobs/components/job/unmet_prerequisites_block_spec.js b/spec/frontend/jobs/components/job/unmet_prerequisites_block_spec.js new file mode 100644 index 00000000000..fb7d389c4d6 --- /dev/null +++ b/spec/frontend/jobs/components/job/unmet_prerequisites_block_spec.js @@ -0,0 +1,41 @@ +import { GlAlert, GlLink } from '@gitlab/ui'; +import { shallowMount } from '@vue/test-utils'; +import UnmetPrerequisitesBlock from '~/jobs/components/job/unmet_prerequisites_block.vue'; + +describe('Unmet Prerequisites Block Job component', () => { + let wrapper; + const helpPath = '/user/project/clusters/index.html#troubleshooting-failed-deployment-jobs'; + + const createComponent = () => { + wrapper = shallowMount(UnmetPrerequisitesBlock, { + propsData: { + helpPath, + }, + }); + }; + + beforeEach(() => { + createComponent(); + }); + + afterEach(() => { + wrapper.destroy(); + }); + + it('renders an alert with the correct message', () => { + const container = wrapper.findComponent(GlAlert); + const alertMessage = + 'This job failed because the necessary resources were not successfully created.'; + + expect(container).not.toBeNull(); + expect(container.text()).toContain(alertMessage); + }); + + it('renders link to help page', () => { + const helpLink = wrapper.findComponent(GlLink); + + expect(helpLink).not.toBeNull(); + expect(helpLink.text()).toContain('More information'); + expect(helpLink.attributes().href).toEqual(helpPath); + }); +}); |