2021-01-03 14:25:43 +05:30
|
|
|
import { GlPopover } from '@gitlab/ui';
|
2021-03-11 19:13:27 +05:30
|
|
|
import { shallowMount } from '@vue/test-utils';
|
2021-01-03 14:25:43 +05:30
|
|
|
import NodeErrorHelpText from '~/clusters_list/components/node_error_help_text.vue';
|
|
|
|
|
|
|
|
describe('NodeErrorHelpText', () => {
|
|
|
|
let wrapper;
|
|
|
|
|
2021-03-08 18:12:59 +05:30
|
|
|
const createWrapper = (propsData) => {
|
2021-01-03 14:25:43 +05:30
|
|
|
wrapper = shallowMount(NodeErrorHelpText, { propsData, stubs: { GlPopover } });
|
|
|
|
return wrapper.vm.$nextTick();
|
|
|
|
};
|
|
|
|
|
|
|
|
const findPopover = () => wrapper.find(GlPopover);
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
wrapper.destroy();
|
|
|
|
});
|
|
|
|
|
|
|
|
it.each`
|
|
|
|
errorType | wrapperText | popoverText
|
|
|
|
${'authentication_error'} | ${'Unable to Authenticate'} | ${'GitLab failed to authenticate'}
|
|
|
|
${'connection_error'} | ${'Unable to Connect'} | ${'GitLab failed to connect to the cluster'}
|
|
|
|
${'http_error'} | ${'Unable to Connect'} | ${'There was an HTTP error when connecting to your cluster'}
|
|
|
|
${'default'} | ${'Unknown Error'} | ${'An unknown error occurred while attempting to connect to Kubernetes.'}
|
|
|
|
${'unknown_error_type'} | ${'Unknown Error'} | ${'An unknown error occurred while attempting to connect to Kubernetes.'}
|
|
|
|
${null} | ${'Unknown Error'} | ${'An unknown error occurred while attempting to connect to Kubernetes.'}
|
|
|
|
`('displays error text', ({ errorType, wrapperText, popoverText }) => {
|
|
|
|
return createWrapper({ errorType, popoverId: 'id' }).then(() => {
|
|
|
|
expect(wrapper.text()).toContain(wrapperText);
|
|
|
|
expect(findPopover().text()).toContain(popoverText);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|