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

42 lines
1.1 KiB
JavaScript
Raw Normal View History

2021-02-22 17:27:13 +05:30
import { shallowMount } from '@vue/test-utils';
import { GlAlert, GlLink } from '@gitlab/ui';
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
});
});