2021-02-14 18:09:20 +00:00
|
|
|
import { GlButton } from '@gitlab/ui';
|
2020-06-15 15:08:20 +00:00
|
|
|
import { shallowMount } from '@vue/test-utils';
|
|
|
|
|
2020-12-14 12:09:44 +00:00
|
|
|
import BitbucketStatusTable from '~/import_entities/import_projects/components/bitbucket_status_table.vue';
|
2021-02-14 18:09:20 +00:00
|
|
|
import BitbucketServerStatusTable from '~/pages/import/bitbucket_server/status/components/bitbucket_server_status_table.vue';
|
2020-06-15 15:08:20 +00:00
|
|
|
|
|
|
|
const BitbucketStatusTableStub = {
|
|
|
|
name: 'BitbucketStatusTable',
|
|
|
|
template: '<div><slot name="actions"></slot></div>',
|
|
|
|
};
|
|
|
|
|
|
|
|
describe('BitbucketServerStatusTable', () => {
|
|
|
|
let wrapper;
|
|
|
|
|
|
|
|
const findReconfigureButton = () =>
|
|
|
|
wrapper
|
|
|
|
.findAll(GlButton)
|
2020-12-24 00:10:25 +00:00
|
|
|
.filter((w) => w.props().variant === 'info')
|
2020-06-15 15:08:20 +00:00
|
|
|
.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-08-28 12:10:37 +00:00
|
|
|
expect(wrapper.find(BitbucketStatusTable).exists()).toBe(true);
|
2020-06-15 15:08:20 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('renders Reconfigure button', async () => {
|
|
|
|
createComponent(BitbucketStatusTableStub);
|
|
|
|
expect(findReconfigureButton().attributes().href).toBe('/reconfigure');
|
|
|
|
expect(findReconfigureButton().text()).toBe('Reconfigure');
|
|
|
|
});
|
|
|
|
});
|