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:
Diffstat (limited to 'spec/frontend/api/groups_api_spec.js')
-rw-r--r--spec/frontend/api/groups_api_spec.js32
1 files changed, 30 insertions, 2 deletions
diff --git a/spec/frontend/api/groups_api_spec.js b/spec/frontend/api/groups_api_spec.js
index c354d8a9416..0315db02cf2 100644
--- a/spec/frontend/api/groups_api_spec.js
+++ b/spec/frontend/api/groups_api_spec.js
@@ -3,7 +3,7 @@ import getGroupTransferLocationsResponse from 'test_fixtures/api/groups/transfer
import { HTTP_STATUS_OK } from '~/lib/utils/http_status';
import axios from '~/lib/utils/axios_utils';
import { DEFAULT_PER_PAGE } from '~/api';
-import { updateGroup, getGroupTransferLocations } from '~/api/groups_api';
+import { updateGroup, getGroupTransferLocations, getGroupMembers } from '~/api/groups_api';
const mockApiVersion = 'v4';
const mockUrlRoot = '/gitlab';
@@ -55,7 +55,9 @@ describe('GroupsApi', () => {
const params = { page: 1 };
const expectedUrl = `${mockUrlRoot}/api/${mockApiVersion}/groups/${mockGroupId}/transfer_locations`;
- mock.onGet(expectedUrl).replyOnce(200, { data: getGroupTransferLocationsResponse });
+ mock
+ .onGet(expectedUrl)
+ .replyOnce(HTTP_STATUS_OK, { data: getGroupTransferLocationsResponse });
await expect(getGroupTransferLocations(mockGroupId, params)).resolves.toMatchObject({
data: { data: getGroupTransferLocationsResponse },
@@ -66,4 +68,30 @@ describe('GroupsApi', () => {
});
});
});
+
+ describe('getGroupMembers', () => {
+ it('requests members of a group', async () => {
+ const expectedUrl = `${mockUrlRoot}/api/${mockApiVersion}/groups/${mockGroupId}/members`;
+
+ const response = [{ id: 0, username: 'root' }];
+
+ mock.onGet(expectedUrl).replyOnce(HTTP_STATUS_OK, response);
+
+ await expect(getGroupMembers(mockGroupId)).resolves.toMatchObject({
+ data: response,
+ });
+ });
+
+ it('requests inherited members of a group when requested', async () => {
+ const expectedUrl = `${mockUrlRoot}/api/${mockApiVersion}/groups/${mockGroupId}/members/all`;
+
+ const response = [{ id: 0, username: 'root' }];
+
+ mock.onGet(expectedUrl).replyOnce(HTTP_STATUS_OK, response);
+
+ await expect(getGroupMembers(mockGroupId, true)).resolves.toMatchObject({
+ data: response,
+ });
+ });
+ });
});