2021-12-03 03:14:42 +00:00
|
|
|
import { shallowMount } from '@vue/test-utils';
|
|
|
|
import { GlTab, GlTabs } from '@gitlab/ui';
|
|
|
|
import Home from '~/google_cloud/components/home.vue';
|
|
|
|
import ServiceAccountsList from '~/google_cloud/components/service_accounts_list.vue';
|
|
|
|
|
|
|
|
describe('google_cloud Home component', () => {
|
|
|
|
let wrapper;
|
|
|
|
|
|
|
|
const findTabs = () => wrapper.findComponent(GlTabs);
|
|
|
|
const findTabItems = () => findTabs().findAllComponents(GlTab);
|
|
|
|
const findTabItemsModel = () =>
|
|
|
|
findTabs()
|
|
|
|
.findAllComponents(GlTab)
|
|
|
|
.wrappers.map((x) => ({
|
|
|
|
title: x.attributes('title'),
|
|
|
|
disabled: x.attributes('disabled'),
|
|
|
|
}));
|
|
|
|
|
|
|
|
const TEST_HOME_PROPS = {
|
|
|
|
serviceAccounts: [{}, {}],
|
2022-02-23 18:16:59 +00:00
|
|
|
gcpRegions: [{}, {}],
|
2021-12-03 03:14:42 +00:00
|
|
|
createServiceAccountUrl: '#url-create-service-account',
|
2022-02-23 18:16:59 +00:00
|
|
|
configureGcpRegionsUrl: '#url-configure-gcp-regions',
|
2021-12-03 03:14:42 +00:00
|
|
|
emptyIllustrationUrl: '#url-empty-illustration',
|
2022-02-11 18:18:58 +00:00
|
|
|
enableCloudRunUrl: '#url-enable-cloud-run',
|
|
|
|
enableCloudStorageUrl: '#enableCloudStorageUrl',
|
2022-03-15 12:07:44 +00:00
|
|
|
revokeOauthUrl: '#revokeOauthUrl',
|
2021-12-03 03:14:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
const propsData = {
|
|
|
|
screen: 'home',
|
|
|
|
...TEST_HOME_PROPS,
|
|
|
|
};
|
|
|
|
wrapper = shallowMount(Home, { propsData });
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
wrapper.destroy();
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('google_cloud App tabs', () => {
|
|
|
|
it('should contain tabs', () => {
|
|
|
|
expect(findTabs().exists()).toBe(true);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should contain three tab items', () => {
|
|
|
|
expect(findTabItemsModel()).toEqual([
|
|
|
|
{ title: 'Configuration', disabled: undefined },
|
2022-01-14 12:18:55 +00:00
|
|
|
{ title: 'Deployments', disabled: undefined },
|
2021-12-03 03:14:42 +00:00
|
|
|
{ title: 'Services', disabled: '' },
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('configuration tab', () => {
|
|
|
|
it('should contain service accounts component', () => {
|
|
|
|
const serviceAccounts = findTabItems().at(0).findComponent(ServiceAccountsList);
|
|
|
|
expect(serviceAccounts.props()).toEqual({
|
|
|
|
list: TEST_HOME_PROPS.serviceAccounts,
|
|
|
|
createUrl: TEST_HOME_PROPS.createServiceAccountUrl,
|
|
|
|
emptyIllustrationUrl: TEST_HOME_PROPS.emptyIllustrationUrl,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|