Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/import_entities/import_groups')
-rw-r--r--spec/frontend/import_entities/import_groups/components/import_table_spec.js31
-rw-r--r--spec/frontend/import_entities/import_groups/utils_spec.js56
2 files changed, 86 insertions, 1 deletions
diff --git a/spec/frontend/import_entities/import_groups/components/import_table_spec.js b/spec/frontend/import_entities/import_groups/components/import_table_spec.js
index b17ff2e0f52..1939e43e5dc 100644
--- a/spec/frontend/import_entities/import_groups/components/import_table_spec.js
+++ b/spec/frontend/import_entities/import_groups/components/import_table_spec.js
@@ -9,7 +9,7 @@ import createFlash from '~/flash';
import httpStatus from '~/lib/utils/http_status';
import axios from '~/lib/utils/axios_utils';
import { STATUSES } from '~/import_entities/constants';
-import { i18n } from '~/import_entities/import_groups/constants';
+import { i18n, ROOT_NAMESPACE } from '~/import_entities/import_groups/constants';
import ImportTable from '~/import_entities/import_groups/components/import_table.vue';
import importGroupsMutation from '~/import_entities/import_groups/graphql/mutations/import_groups.mutation.graphql';
import PaginationLinks from '~/vue_shared/components/pagination_links.vue';
@@ -45,6 +45,8 @@ describe('import table', () => {
const findImportButtons = () =>
wrapper.findAll('button').wrappers.filter((w) => w.text() === 'Import');
const findPaginationDropdown = () => wrapper.find('[data-testid="page-size"]');
+ const findTargetNamespaceDropdown = (rowWrapper) =>
+ rowWrapper.find('[data-testid="target-namespace-selector"]');
const findPaginationDropdownText = () => findPaginationDropdown().find('button').text();
const findSelectionCount = () => wrapper.find('[data-test-id="selection-count"]');
@@ -70,6 +72,7 @@ describe('import table', () => {
groupPathRegex: /.*/,
jobsPath: '/fake_job_path',
sourceUrl: SOURCE_URL,
+ historyPath: '/fake_history_path',
},
apolloProvider,
});
@@ -136,6 +139,32 @@ describe('import table', () => {
expect(wrapper.findAll('tbody tr')).toHaveLength(FAKE_GROUPS.length);
});
+ it('correctly maintains root namespace as last import target', async () => {
+ createComponent({
+ bulkImportSourceGroups: () => ({
+ nodes: [
+ {
+ ...generateFakeEntry({ id: 1, status: STATUSES.FINISHED }),
+ lastImportTarget: {
+ id: 1,
+ targetNamespace: ROOT_NAMESPACE.fullPath,
+ newName: 'does-not-matter',
+ },
+ },
+ ],
+ pageInfo: FAKE_PAGE_INFO,
+ versionValidation: FAKE_VERSION_VALIDATION,
+ }),
+ });
+
+ await waitForPromises();
+ const firstRow = wrapper.find('tbody tr');
+ const targetNamespaceDropdownButton = findTargetNamespaceDropdown(firstRow).find(
+ '[aria-haspopup]',
+ );
+ expect(targetNamespaceDropdownButton.text()).toBe('No parent');
+ });
+
it('does not render status string when result list is empty', async () => {
createComponent({
bulkImportSourceGroups: jest.fn().mockResolvedValue({
diff --git a/spec/frontend/import_entities/import_groups/utils_spec.js b/spec/frontend/import_entities/import_groups/utils_spec.js
new file mode 100644
index 00000000000..2892c5c217b
--- /dev/null
+++ b/spec/frontend/import_entities/import_groups/utils_spec.js
@@ -0,0 +1,56 @@
+import { STATUSES } from '~/import_entities/constants';
+import { isFinished, isAvailableForImport } from '~/import_entities/import_groups/utils';
+
+const FINISHED_STATUSES = [STATUSES.FINISHED, STATUSES.FAILED, STATUSES.TIMEOUT];
+const OTHER_STATUSES = Object.values(STATUSES).filter(
+ (status) => !FINISHED_STATUSES.includes(status),
+);
+describe('gitlab migration status utils', () => {
+ describe('isFinished', () => {
+ it.each(FINISHED_STATUSES.map((s) => [s]))(
+ 'reports group as finished when import status is %s',
+ (status) => {
+ expect(isFinished({ progress: { status } })).toBe(true);
+ },
+ );
+
+ it.each(OTHER_STATUSES.map((s) => [s]))(
+ 'does not report group as finished when import status is %s',
+ (status) => {
+ expect(isFinished({ progress: { status } })).toBe(false);
+ },
+ );
+
+ it('does not report group as finished when there is no progress', () => {
+ expect(isFinished({ progress: null })).toBe(false);
+ });
+
+ it('does not report group as finished when status is unknown', () => {
+ expect(isFinished({ progress: { status: 'weird' } })).toBe(false);
+ });
+ });
+
+ describe('isAvailableForImport', () => {
+ it.each(FINISHED_STATUSES.map((s) => [s]))(
+ 'reports group as available for import when status is %s',
+ (status) => {
+ expect(isAvailableForImport({ progress: { status } })).toBe(true);
+ },
+ );
+
+ it.each(OTHER_STATUSES.map((s) => [s]))(
+ 'does not report group as not available for import when status is %s',
+ (status) => {
+ expect(isAvailableForImport({ progress: { status } })).toBe(false);
+ },
+ );
+
+ it('reports group as available for import when there is no progress', () => {
+ expect(isAvailableForImport({ progress: null })).toBe(true);
+ });
+
+ it('reports group as finished when status is unknown', () => {
+ expect(isFinished({ progress: { status: 'weird' } })).toBe(false);
+ });
+ });
+});