2022-04-06 09:09:15 +00:00
|
|
|
import { GlEmptyState, GlSprintf, GlLink } from '@gitlab/ui';
|
2021-10-08 18:13:02 +00:00
|
|
|
import AgentEmptyState from '~/clusters_list/components/agent_empty_state.vue';
|
|
|
|
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
|
2021-11-15 15:10:57 +00:00
|
|
|
import { helpPagePath } from '~/helpers/help_page_helper';
|
2021-10-08 18:13:02 +00:00
|
|
|
|
|
|
|
const emptyStateImage = '/path/to/image';
|
2021-12-02 21:10:16 +00:00
|
|
|
const installDocsUrl = helpPagePath('user/clusters/agent/index');
|
2021-10-08 18:13:02 +00:00
|
|
|
|
|
|
|
describe('AgentEmptyStateComponent', () => {
|
|
|
|
let wrapper;
|
|
|
|
const provideData = {
|
|
|
|
emptyStateImage,
|
|
|
|
};
|
|
|
|
|
2021-12-02 21:10:16 +00:00
|
|
|
const findInstallDocsLink = () => wrapper.findComponent(GlLink);
|
2021-10-08 18:13:02 +00:00
|
|
|
const findEmptyState = () => wrapper.findComponent(GlEmptyState);
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
wrapper = shallowMountExtended(AgentEmptyState, {
|
|
|
|
provide: provideData,
|
2022-04-06 09:09:15 +00:00
|
|
|
stubs: { GlSprintf },
|
2021-10-08 18:13:02 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
if (wrapper) {
|
|
|
|
wrapper.destroy();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-11-19 12:12:41 +00:00
|
|
|
it('renders the empty state', () => {
|
|
|
|
expect(findEmptyState().exists()).toBe(true);
|
|
|
|
});
|
|
|
|
|
2021-12-02 21:10:16 +00:00
|
|
|
it('renders correct href attributes for the docs link', () => {
|
2021-10-08 18:13:02 +00:00
|
|
|
expect(findInstallDocsLink().attributes('href')).toBe(installDocsUrl);
|
|
|
|
});
|
|
|
|
});
|