debian-mirror-gitlab/spec/frontend/google_cloud/deployments/service_table_spec.js
2022-08-13 15:12:31 +05:30

41 lines
1.4 KiB
JavaScript

import { mount } from '@vue/test-utils';
import { GlButton, GlTable } from '@gitlab/ui';
import DeploymentsServiceTable from '~/google_cloud/deployments/service_table.vue';
describe('google_cloud/deployments/service_table', () => {
let wrapper;
const findTable = () => wrapper.findComponent(GlTable);
const findButtons = () => findTable().findAllComponents(GlButton);
const findCloudRunButton = () => findButtons().at(0);
const findCloudStorageButton = () => findButtons().at(1);
beforeEach(() => {
const propsData = {
cloudRunUrl: '#url-enable-cloud-run',
cloudStorageUrl: '#url-enable-cloud-storage',
};
wrapper = mount(DeploymentsServiceTable, { propsData });
});
afterEach(() => {
wrapper.destroy();
});
it('should contain a table', () => {
expect(findTable().exists()).toBe(true);
});
it('should contain configure cloud run button', () => {
const cloudRunButton = findCloudRunButton();
expect(cloudRunButton.exists()).toBe(true);
expect(cloudRunButton.attributes('href')).toBe('#url-enable-cloud-run');
});
it('should contain configure cloud storage button', () => {
const cloudStorageButton = findCloudStorageButton();
expect(cloudStorageButton.exists()).toBe(true);
expect(cloudStorageButton.props().disabled).toBe(true);
expect(cloudStorageButton.attributes('href')).toBe('#url-enable-cloud-storage');
});
});