diff options
author | Phil Hughes <me@iamphill.com> | 2019-06-19 11:21:48 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2019-06-19 11:21:48 +0100 |
commit | 778c705ffd99df0877159c10c39f0ab6964a52a7 (patch) | |
tree | c11f89870db485e6cd619036b2114ecc58e9f862 /spec/frontend/api_spec.js | |
parent | 8716eb0cef94dbbaab5821aa693a9d92fa9f37e8 (diff) | |
download | gitlab-ce-778c705ffd99df0877159c10c39f0ab6964a52a7.tar.gz |
Added forked projects API call function
Part of https://gitlab.com/gitlab-org/gitlab-ce/issues/58583
Diffstat (limited to 'spec/frontend/api_spec.js')
-rw-r--r-- | spec/frontend/api_spec.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/frontend/api_spec.js b/spec/frontend/api_spec.js index 6010488d9e0..0188d12a57d 100644 --- a/spec/frontend/api_spec.js +++ b/spec/frontend/api_spec.js @@ -474,4 +474,27 @@ describe('Api', () => { .catch(done.fail); }); }); + + describe('projectForks', () => { + it('gets forked projects', done => { + const dummyProjectPath = 'gitlab-org/gitlab-ce'; + const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/projects/${encodeURIComponent( + dummyProjectPath, + )}/forks`; + + jest.spyOn(axios, 'get'); + + mock.onGet(expectedUrl).replyOnce(200, ['fork']); + + Api.projectForks(dummyProjectPath, { visibility: 'private' }) + .then(({ data }) => { + expect(data).toEqual(['fork']); + expect(axios.get).toHaveBeenCalledWith(expectedUrl, { + params: { visibility: 'private' }, + }); + }) + .then(done) + .catch(done.fail); + }); + }); }); |