diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 01:45:44 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 01:45:44 +0000 |
commit | 85dc423f7090da0a52c73eb66faf22ddb20efff9 (patch) | |
tree | 9160f299afd8c80c038f08e1545be119f5e3f1e1 /spec/frontend/import_projects/store/getters_spec.js | |
parent | 15c2c8c66dbe422588e5411eee7e68f1fa440bb8 (diff) | |
download | gitlab-ce-85dc423f7090da0a52c73eb66faf22ddb20efff9.tar.gz |
Add latest changes from gitlab-org/gitlab@13-4-stable-ee
Diffstat (limited to 'spec/frontend/import_projects/store/getters_spec.js')
-rw-r--r-- | spec/frontend/import_projects/store/getters_spec.js | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/spec/frontend/import_projects/store/getters_spec.js b/spec/frontend/import_projects/store/getters_spec.js index 5c1ea25a684..1ce42e534ea 100644 --- a/spec/frontend/import_projects/store/getters_spec.js +++ b/spec/frontend/import_projects/store/getters_spec.js @@ -3,6 +3,7 @@ import { isImportingAnyRepo, hasIncompatibleRepos, hasImportableRepos, + importAllCount, getImportTarget, } from '~/import_projects/store/getters'; import { STATUSES } from '~/import_projects/constants'; @@ -10,13 +11,12 @@ import state from '~/import_projects/store/state'; const IMPORTED_REPO = { importSource: {}, - importedProject: { fullPath: 'some/path' }, + importedProject: { fullPath: 'some/path', importStatus: STATUSES.FINISHED }, }; const IMPORTABLE_REPO = { importSource: { id: 'some-id', sanitizedName: 'sanitized' }, importedProject: null, - importStatus: STATUSES.NONE, }; const INCOMPATIBLE_REPO = { @@ -56,14 +56,20 @@ describe('import_projects store getters', () => { ${STATUSES.STARTED} | ${true} ${STATUSES.FINISHED} | ${false} `( - 'isImportingAnyRepo returns $value when repo with $importStatus status is available', + 'isImportingAnyRepo returns $value when project with $importStatus status is available', ({ importStatus, value }) => { - localState.repositories = [{ importStatus }]; + localState.repositories = [{ importedProject: { importStatus } }]; expect(isImportingAnyRepo(localState)).toBe(value); }, ); + it('isImportingAnyRepo returns false when project with no defined importStatus status is available', () => { + localState.repositories = [{ importSource: {} }]; + + expect(isImportingAnyRepo(localState)).toBe(false); + }); + describe('hasIncompatibleRepos', () => { it('returns true if there are any incompatible projects', () => { localState.repositories = [IMPORTABLE_REPO, IMPORTED_REPO, INCOMPATIBLE_REPO]; @@ -92,6 +98,19 @@ describe('import_projects store getters', () => { }); }); + describe('importAllCount', () => { + it('returns count of available importable projects ', () => { + localState.repositories = [ + IMPORTABLE_REPO, + IMPORTABLE_REPO, + IMPORTED_REPO, + INCOMPATIBLE_REPO, + ]; + + expect(importAllCount(localState)).toBe(2); + }); + }); + describe('getImportTarget', () => { it('returns default value if no custom target available', () => { localState.defaultTargetNamespace = 'default'; |