diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
commit | 36a59d088eca61b834191dacea009677a96c052f (patch) | |
tree | e4f33972dab5d8ef79e3944a9f403035fceea43f /spec/frontend/import_entities/import_groups/utils_spec.js | |
parent | a1761f15ec2cae7c7f7bbda39a75494add0dfd6f (diff) |
Add latest changes from gitlab-org/gitlab@15-0-stable-eev15.0.0-rc42
Diffstat (limited to 'spec/frontend/import_entities/import_groups/utils_spec.js')
-rw-r--r-- | spec/frontend/import_entities/import_groups/utils_spec.js | 56 |
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); + }); + }); +}); |