2021-02-11 10:09:11 -05:00
|
|
|
import { mount } from '@vue/test-utils';
|
2021-03-09 13:09:41 -05:00
|
|
|
import { UPGRADE_CTA } from '~/security_configuration/components/scanners_constants';
|
2021-02-14 13:09:20 -05:00
|
|
|
import Upgrade from '~/security_configuration/components/upgrade.vue';
|
2021-02-11 10:09:11 -05:00
|
|
|
|
2021-02-22 10:10:48 -05:00
|
|
|
const TEST_URL = 'http://www.example.test';
|
2021-02-11 10:09:11 -05:00
|
|
|
let wrapper;
|
2021-02-22 10:10:48 -05:00
|
|
|
const createComponent = (componentData = {}) => {
|
|
|
|
wrapper = mount(Upgrade, componentData);
|
2021-02-11 10:09:11 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
wrapper.destroy();
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('Upgrade component', () => {
|
2021-02-22 10:10:48 -05:00
|
|
|
beforeEach(() => {
|
|
|
|
createComponent({ provide: { upgradePath: TEST_URL } });
|
|
|
|
});
|
|
|
|
|
2021-02-11 10:09:11 -05:00
|
|
|
it('renders correct text in link', () => {
|
|
|
|
expect(wrapper.text()).toMatchInterpolatedText(UPGRADE_CTA);
|
|
|
|
});
|
|
|
|
|
2021-02-22 10:10:48 -05:00
|
|
|
it('renders link with correct default attributes', () => {
|
2021-02-11 10:09:11 -05:00
|
|
|
expect(wrapper.find('a').attributes()).toMatchObject({
|
2021-02-22 10:10:48 -05:00
|
|
|
href: TEST_URL,
|
2021-02-11 10:09:11 -05:00
|
|
|
target: '_blank',
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|