diff options
Diffstat (limited to 'spec/frontend/import_entities/import_projects/store/actions_spec.js')
-rw-r--r-- | spec/frontend/import_entities/import_projects/store/actions_spec.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/frontend/import_entities/import_projects/store/actions_spec.js b/spec/frontend/import_entities/import_projects/store/actions_spec.js index 3b94db37801..918821dfa59 100644 --- a/spec/frontend/import_entities/import_projects/store/actions_spec.js +++ b/spec/frontend/import_entities/import_projects/store/actions_spec.js @@ -17,6 +17,7 @@ import { SET_PAGE, SET_FILTER, SET_PAGE_CURSORS, + SET_HAS_NEXT_PAGE, } from '~/import_entities/import_projects/store/mutation_types'; import state from '~/import_entities/import_projects/store/state'; import axios from '~/lib/utils/axios_utils'; @@ -143,6 +144,44 @@ describe('import_projects store actions', () => { ); }); }); + + describe('when provider is BITBUCKET_SERVER', () => { + beforeEach(() => { + localState.provider = PROVIDERS.BITBUCKET_SERVER; + }); + + describe.each` + reposLength | expectedHasNextPage + ${0} | ${false} + ${12} | ${false} + ${20} | ${false} + ${25} | ${true} + `('when reposLength is $reposLength', ({ reposLength, expectedHasNextPage }) => { + beforeEach(() => { + payload.provider_repos = Array(reposLength).fill({}); + + mock.onGet(MOCK_ENDPOINT).reply(HTTP_STATUS_OK, payload); + }); + + it('commits SET_HAS_NEXT_PAGE', () => { + return testAction( + fetchRepos, + null, + localState, + [ + { type: REQUEST_REPOS }, + { type: SET_PAGE, payload: 1 }, + { type: SET_HAS_NEXT_PAGE, payload: expectedHasNextPage }, + { + type: RECEIVE_REPOS_SUCCESS, + payload: convertObjectPropsToCamelCase(payload, { deep: true }), + }, + ], + [], + ); + }); + }); + }); }); it('commits REQUEST_REPOS, RECEIVE_REPOS_ERROR mutations on an unsuccessful request', () => { |