Commit 17d96b2c authored by Justin Ho's avatar Justin Ho

Add basic spec for subscriptions_list.vue

parent 5ec4c4ff
import { GlEmptyState, GlTable } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import SubscriptionsList from '~/jira_connect/components/subscriptions_list.vue';
import { mockSubscription } from '../mock_data';
describe('SubscriptionsList', () => {
let wrapper;
const createComponent = ({ provide = {} } = {}) => {
wrapper = shallowMount(SubscriptionsList, {
provide,
});
};
afterEach(() => {
wrapper.destroy();
});
const findGlEmptyState = () => wrapper.findComponent(GlEmptyState);
const findGlTable = () => wrapper.findComponent(GlTable);
describe('template', () => {
it('renders GlEmptyState when subscriptions is empty', () => {
createComponent();
expect(findGlEmptyState().exists()).toBe(true);
expect(findGlTable().exists()).toBe(false);
});
it('renders GlTable when subscriptions are present', () => {
createComponent({
provide: {
subscriptions: [mockSubscription],
},
});
expect(findGlEmptyState().exists()).toBe(false);
expect(findGlTable().exists()).toBe(true);
});
});
});
......@@ -15,3 +15,9 @@ export const mockGroup2 = {
full_path: 'gitlab-com',
description: 'For GitLab company related projects',
};
export const mockSubscription = {
group: mockGroup1,
created_at: '2021-04-14T08:52:23.115Z',
unlink_path: '/-/jira_connect/subscriptions/1',
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment