2021-03-11 19:13:27 +05:30
|
|
|
import { GlButton } from '@gitlab/ui';
|
2020-06-23 00:09:42 +05:30
|
|
|
import { shallowMount } from '@vue/test-utils';
|
|
|
|
|
2021-02-22 17:27:13 +05:30
|
|
|
import BitbucketStatusTable from '~/import_entities/import_projects/components/bitbucket_status_table.vue';
|
2021-03-11 19:13:27 +05:30
|
|
|
import BitbucketServerStatusTable from '~/pages/import/bitbucket_server/status/components/bitbucket_server_status_table.vue';
|
2020-06-23 00:09:42 +05:30
|
|
|
|
|
|
|
const BitbucketStatusTableStub = {
|
|
|
|
name: 'BitbucketStatusTable',
|
|
|
|
template: '<div><slot name="actions"></slot></div>',
|
|
|
|
};
|
|
|
|
|
|
|
|
describe('BitbucketServerStatusTable', () => {
|
|
|
|
let wrapper;
|
|
|
|
|
|
|
|
const findReconfigureButton = () =>
|
|
|
|
wrapper
|
|
|
|
.findAll(GlButton)
|
2021-03-08 18:12:59 +05:30
|
|
|
.filter((w) => w.props().variant === 'info')
|
2020-06-23 00:09:42 +05:30
|
|
|
.at(0);
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
if (wrapper) {
|
|
|
|
wrapper.destroy();
|
|
|
|
wrapper = null;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
function createComponent(bitbucketStatusTableStub = true) {
|
|
|
|
wrapper = shallowMount(BitbucketServerStatusTable, {
|
|
|
|
propsData: { providerTitle: 'Test', reconfigurePath: '/reconfigure' },
|
|
|
|
stubs: {
|
|
|
|
BitbucketStatusTable: bitbucketStatusTableStub,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
it('renders bitbucket status table component', () => {
|
|
|
|
createComponent();
|
2020-11-24 15:15:51 +05:30
|
|
|
expect(wrapper.find(BitbucketStatusTable).exists()).toBe(true);
|
2020-06-23 00:09:42 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('renders Reconfigure button', async () => {
|
|
|
|
createComponent(BitbucketStatusTableStub);
|
|
|
|
expect(findReconfigureButton().attributes().href).toBe('/reconfigure');
|
|
|
|
expect(findReconfigureButton().text()).toBe('Reconfigure');
|
|
|
|
});
|
|
|
|
});
|