Commit 36bf03d5 authored by Brandon Labuschagne's avatar Brandon Labuschagne

DA fetch top level groups

parent 141b45f3
...@@ -13,6 +13,7 @@ export const resolvers = { ...@@ -13,6 +13,7 @@ export const resolvers = {
const params = { const params = {
per_page: Api.DEFAULT_PER_PAGE, per_page: Api.DEFAULT_PER_PAGE,
search, search,
top_level_only: true,
}; };
if (nextPage) { if (nextPage) {
params.page = nextPage; params.page = nextPage;
......
---
title: Ensure that only top level groups are fetched for devops adoption
merge_request: 51565
author:
type: fixed
...@@ -23,6 +23,15 @@ describe('DevOps GraphQL resolvers', () => { ...@@ -23,6 +23,15 @@ describe('DevOps GraphQL resolvers', () => {
}); });
describe('groups query', () => { describe('groups query', () => {
it('only fetches top level groups', async () => {
mockAdapter.onGet(fetchGroupsUrl).reply(httpStatus.OK, groupData, pageData);
await mockClient.query({ query: getGroupsQuery });
expect(mockAdapter.history.get[0].params).toEqual(
expect.objectContaining({ top_level_only: true }),
);
});
it('when receiving groups data', async () => { it('when receiving groups data', async () => {
mockAdapter.onGet(fetchGroupsUrl).reply(httpStatus.OK, groupData, pageData); mockAdapter.onGet(fetchGroupsUrl).reply(httpStatus.OK, groupData, pageData);
const result = await mockClient.query({ query: getGroupsQuery }); const result = await mockClient.query({ query: getGroupsQuery });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment