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:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-05-05 15:08:03 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-05-05 15:08:03 +0300
commit3c86701bc89302550abb9bbaa060132fdcd52480 (patch)
treeb73328cbd2de6d43afd0eb5253ec215274011dc8 /spec/frontend/import_entities
parent17ef30f3df6d3939e41e69efc7cfa3deaa08605d (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/import_entities')
-rw-r--r--spec/frontend/import_entities/import_groups/utils_spec.js56
1 files changed, 56 insertions, 0 deletions
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);
+ });
+ });
+});