Commit 55c172c1 authored by Illya Klymov's avatar Illya Klymov

Address reviewer comments

- improve readability
- switch to toHaveLength
- improve feature spec
parent b35e51e2
<script>
import { GlButton, GlIcon, GlLink, GlFormInput } from '@gitlab/ui';
import { joinPaths } from '~/lib/utils/url_utility';
import Select2Select from '~/vue_shared/components/select2_select.vue';
import ImportStatus from '../../components/import_status.vue';
import { STATUSES } from '../../constants';
......@@ -47,7 +48,7 @@ export default {
},
getFullPath(group) {
return `${gon.relative_url_root || ''}/${this.getPath(group)}`;
return joinPaths(gon.relative_url_root || '/', this.getPath(group));
},
},
};
......
......@@ -22,6 +22,19 @@ RSpec.describe 'Import/Export - Connect to another instance', :js do
it 'successfully connects to remote instance' do
source_url = 'https://gitlab.com'
pat = 'demo-pat'
stub_path = 'stub-group'
stub_request(:get, "%{url}/api/v4/groups?page=1&per_page=30&top_level_only=true" % { url: source_url }).to_return(
body: [{
id: 2595438,
web_url: 'https://gitlab.com/groups/auto-breakfast',
name: 'Stub',
path: stub_path,
full_name: 'Stub',
full_path: stub_path
}].to_json,
headers: { 'Content-Type' => 'application/json' }
)
expect(page).to have_content 'Import groups from another instance of GitLab'
......@@ -31,6 +44,7 @@ RSpec.describe 'Import/Export - Connect to another instance', :js do
click_on 'Connect instance'
expect(page).to have_content 'Importing groups from %{url}' % { url: source_url }
expect(page).to have_content stub_path
end
end
......
......@@ -72,7 +72,7 @@ describe('import table', () => {
});
await waitForPromises();
expect(wrapper.findAll(ImportTableRow).length).toBe(FAKE_GROUPS.length);
expect(wrapper.findAll(ImportTableRow)).toHaveLength(FAKE_GROUPS.length);
});
describe('converts row events to mutation invocations', () => {
......
......@@ -56,12 +56,11 @@ describe('Bulk import resolvers', () => {
});
it('mirrors REST endpoint response fields', () => {
const MIRRORED_FIELDS = ['id', 'full_path'];
expect(
results.every((r, idx) =>
MIRRORED_FIELDS.every(field => r[field] === availableNamespacesFixture[idx][field]),
),
).toBe(true);
const extractRelevantFields = obj => ({ id: obj.id, full_path: obj.full_path });
expect(results.map(extractRelevantFields)).toStrictEqual(
availableNamespacesFixture.map(extractRelevantFields),
);
});
});
......
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