debian-mirror-gitlab/spec/frontend/security_configuration/upgrade_spec.js

31 lines
816 B
JavaScript
Raw Normal View History

2021-03-11 19:13:27 +05:30
import { mount } from '@vue/test-utils';
2021-06-08 01:23:25 +05:30
import { UPGRADE_CTA } from '~/security_configuration/components/constants';
2021-03-11 19:13:27 +05:30
import Upgrade from '~/security_configuration/components/upgrade.vue';
2021-04-17 20:07:23 +05:30
const TEST_URL = 'http://www.example.test';
2021-03-11 19:13:27 +05:30
let wrapper;
2021-04-17 20:07:23 +05:30
const createComponent = (componentData = {}) => {
wrapper = mount(Upgrade, componentData);
2021-03-11 19:13:27 +05:30
};
afterEach(() => {
wrapper.destroy();
});
describe('Upgrade component', () => {
2021-04-17 20:07:23 +05:30
beforeEach(() => {
createComponent({ provide: { upgradePath: TEST_URL } });
});
2021-03-11 19:13:27 +05:30
it('renders correct text in link', () => {
expect(wrapper.text()).toMatchInterpolatedText(UPGRADE_CTA);
});
2021-04-17 20:07:23 +05:30
it('renders link with correct default attributes', () => {
2021-03-11 19:13:27 +05:30
expect(wrapper.find('a').attributes()).toMatchObject({
2021-04-17 20:07:23 +05:30
href: TEST_URL,
2021-03-11 19:13:27 +05:30
target: '_blank',
});
});
});