debian-mirror-gitlab/spec/frontend/clusters/components/new_cluster_spec.js

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

41 lines
1.1 KiB
JavaScript
Raw Normal View History

2020-11-24 15:15:51 +05:30
import { GlLink, GlSprintf } from '@gitlab/ui';
2021-03-11 19:13:27 +05:30
import { shallowMount } from '@vue/test-utils';
2022-04-04 11:22:00 +05:30
import { nextTick } from 'vue';
2020-11-24 15:15:51 +05:30
import NewCluster from '~/clusters/components/new_cluster.vue';
2022-07-16 23:28:13 +05:30
import { helpPagePath } from '~/helpers/help_page_helper';
2020-11-24 15:15:51 +05:30
describe('NewCluster', () => {
let wrapper;
2022-04-04 11:22:00 +05:30
const createWrapper = async () => {
2022-07-16 23:28:13 +05:30
wrapper = shallowMount(NewCluster, { stubs: { GlLink, GlSprintf } });
2022-04-04 11:22:00 +05:30
await nextTick();
2020-11-24 15:15:51 +05:30
};
const findDescription = () => wrapper.find(GlSprintf);
const findLink = () => wrapper.find(GlLink);
beforeEach(() => {
return createWrapper();
});
afterEach(() => {
wrapper.destroy();
});
it('renders the cluster component correctly', () => {
expect(wrapper.html()).toMatchSnapshot();
});
it('renders the correct information text', () => {
2022-05-07 20:08:51 +05:30
expect(findDescription().text()).toContain('Enter details about your cluster.');
2020-11-24 15:15:51 +05:30
});
it('renders a valid help link set by the backend', () => {
2022-07-16 23:28:13 +05:30
expect(findLink().attributes('href')).toBe(
helpPagePath('user/project/clusters/add_existing_cluster'),
);
2020-11-24 15:15:51 +05:30
});
});