debian-mirror-gitlab/spec/frontend/jobs/components/unmet_prerequisites_block_spec.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

42 lines
1.1 KiB
JavaScript
Raw Normal View History

2021-02-22 17:27:13 +05:30
import { GlAlert, GlLink } from '@gitlab/ui';
2021-03-11 19:13:27 +05:30
import { shallowMount } from '@vue/test-utils';
2021-02-22 17:27:13 +05:30
import UnmetPrerequisitesBlock from '~/jobs/components/unmet_prerequisites_block.vue';
2019-07-07 11:18:12 +05:30
describe('Unmet Prerequisites Block Job component', () => {
2021-02-22 17:27:13 +05:30
let wrapper;
2019-07-07 11:18:12 +05:30
const helpPath = '/user/project/clusters/index.html#troubleshooting-failed-deployment-jobs';
2021-02-22 17:27:13 +05:30
const createComponent = () => {
wrapper = shallowMount(UnmetPrerequisitesBlock, {
propsData: {
helpPath,
},
2019-07-07 11:18:12 +05:30
});
2021-02-22 17:27:13 +05:30
};
beforeEach(() => {
createComponent();
2019-07-07 11:18:12 +05:30
});
afterEach(() => {
2021-02-22 17:27:13 +05:30
wrapper.destroy();
2019-07-07 11:18:12 +05:30
});
it('renders an alert with the correct message', () => {
2021-02-22 17:27:13 +05:30
const container = wrapper.find(GlAlert);
2019-07-07 11:18:12 +05:30
const alertMessage =
'This job failed because the necessary resources were not successfully created.';
expect(container).not.toBeNull();
2021-02-22 17:27:13 +05:30
expect(container.text()).toContain(alertMessage);
2019-07-07 11:18:12 +05:30
});
it('renders link to help page', () => {
2021-02-22 17:27:13 +05:30
const helpLink = wrapper.find(GlLink);
2019-07-07 11:18:12 +05:30
expect(helpLink).not.toBeNull();
2021-02-22 17:27:13 +05:30
expect(helpLink.text()).toContain('More information');
expect(helpLink.attributes().href).toEqual(helpPath);
2019-07-07 11:18:12 +05:30
});
});