Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
f4d69149
Commit
f4d69149
authored
Sep 28, 2021
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab master
parents
ca89f20a
6b755868
Changes
35
Hide whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
530 additions
and
106 deletions
+530
-106
app/assets/images/logos/zentao.svg
app/assets/images/logos/zentao.svg
+14
-0
doc/development/graphql_guide/pagination.md
doc/development/graphql_guide/pagination.md
+3
-3
ee/app/assets/javascripts/integrations/zentao/issues_list/graphql/fragments/zentao_label.fragment.graphql
...sues_list/graphql/fragments/zentao_label.fragment.graphql
+6
-0
ee/app/assets/javascripts/integrations/zentao/issues_list/graphql/fragments/zentao_user.fragment.graphql
...ssues_list/graphql/fragments/zentao_user.fragment.graphql
+5
-0
ee/app/assets/javascripts/integrations/zentao/issues_list/graphql/queries/get_zentao_issues.query.graphql
...sues_list/graphql/queries/get_zentao_issues.query.graphql
+46
-0
ee/app/assets/javascripts/integrations/zentao/issues_list/graphql/resolvers/zentao_issues.js
...ons/zentao/issues_list/graphql/resolvers/zentao_issues.js
+83
-0
ee/app/assets/javascripts/integrations/zentao/issues_list/zentao_issues_list_bundle.js
...egrations/zentao/issues_list/zentao_issues_list_bundle.js
+23
-0
ee/app/assets/javascripts/pages/projects/integrations/zentao/issues/index/index.js
.../pages/projects/integrations/zentao/issues/index/index.js
+3
-0
ee/spec/frontend/integrations/zentao/issues_list/mock_data.js
...pec/frontend/integrations/zentao/issues_list/mock_data.js
+71
-0
ee/spec/frontend/integrations/zentao/issues_list/resolvers/zentao_issues_spec.js
...ations/zentao/issues_list/resolvers/zentao_issues_spec.js
+163
-0
ee/spec/requests/api/graphql/boards/board_lists_query_spec.rb
...pec/requests/api/graphql/boards/board_lists_query_spec.rb
+3
-3
ee/spec/requests/api/graphql/boards/epic_board_list_epics_query_spec.rb
...ts/api/graphql/boards/epic_board_list_epics_query_spec.rb
+1
-1
ee/spec/requests/api/graphql/boards/epic_boards_query_spec.rb
...pec/requests/api/graphql/boards/epic_boards_query_spec.rb
+1
-1
ee/spec/requests/api/graphql/boards/epic_lists_query_spec.rb
ee/spec/requests/api/graphql/boards/epic_lists_query_spec.rb
+1
-1
ee/spec/requests/api/graphql/group/epic/epic_issues_spec.rb
ee/spec/requests/api/graphql/group/epic/epic_issues_spec.rb
+1
-1
ee/spec/requests/api/graphql/group/epics_spec.rb
ee/spec/requests/api/graphql/group/epics_spec.rb
+4
-4
ee/spec/requests/api/graphql/group_query_spec.rb
ee/spec/requests/api/graphql/group_query_spec.rb
+1
-1
ee/spec/requests/api/graphql/namespace/projects_spec.rb
ee/spec/requests/api/graphql/namespace/projects_spec.rb
+3
-3
ee/spec/requests/api/graphql/project/dast_profiles_spec.rb
ee/spec/requests/api/graphql/project/dast_profiles_spec.rb
+1
-1
ee/spec/requests/api/graphql/project/dast_site_validations_spec.rb
...equests/api/graphql/project/dast_site_validations_spec.rb
+1
-1
ee/spec/requests/api/graphql/project/issues_spec.rb
ee/spec/requests/api/graphql/project/issues_spec.rb
+8
-8
ee/spec/requests/api/graphql/project/requirements_management/requirements_spec.rb
...phql/project/requirements_management/requirements_spec.rb
+6
-6
ee/spec/requests/api/graphql/project/requirements_management/test_reports_spec.rb
...phql/project/requirements_management/test_reports_spec.rb
+4
-4
locale/gitlab.pot
locale/gitlab.pot
+9
-0
spec/requests/api/graphql/boards/board_lists_query_spec.rb
spec/requests/api/graphql/boards/board_lists_query_spec.rb
+3
-3
spec/requests/api/graphql/ci/runners_spec.rb
spec/requests/api/graphql/ci/runners_spec.rb
+6
-6
spec/requests/api/graphql/namespace/projects_spec.rb
spec/requests/api/graphql/namespace/projects_spec.rb
+4
-4
spec/requests/api/graphql/project/container_repositories_spec.rb
...quests/api/graphql/project/container_repositories_spec.rb
+2
-2
spec/requests/api/graphql/project/issues_spec.rb
spec/requests/api/graphql/project/issues_spec.rb
+17
-17
spec/requests/api/graphql/project/merge_requests_spec.rb
spec/requests/api/graphql/project/merge_requests_spec.rb
+4
-4
spec/requests/api/graphql/project/releases_spec.rb
spec/requests/api/graphql/project/releases_spec.rb
+12
-12
spec/requests/api/graphql/users_spec.rb
spec/requests/api/graphql/users_spec.rb
+6
-6
spec/support/shared_examples/graphql/sorted_paginated_query_shared_examples.rb
...xamples/graphql/sorted_paginated_query_shared_examples.rb
+9
-9
spec/support/shared_examples/requests/api/graphql/group_and_project_boards_query_shared_examples.rb
...graphql/group_and_project_boards_query_shared_examples.rb
+4
-3
spec/support/shared_examples/requests/api/graphql/packages/group_and_project_packages_list_shared_examples.rb
...ckages/group_and_project_packages_list_shared_examples.rb
+2
-2
No files found.
app/assets/images/logos/zentao.svg
0 → 100644
View file @
f4d69149
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"16px"
height=
"16px"
fill=
"none"
>
<path
fill=
"url(#SVGID_1_)"
d=
"M8,1C4.1,1,1,4.1,1,8s3.1,7,7,7s7-3.1,7-7S11.9,1,8,1L8,1z M11.3,8.2C9.8,7.7,7.9,6.1,5.8,7.6
C4,8.9,4.8,11.1,6,11.8c0.9,0.6,2.3,0.7,3,0.1C9.7,11.4,10,10,9,9.5C8.6,9.4,7.9,9.3,7.5,9.8c-0.5,0.6-0.3,1.4,0.4,1.7
c0,0-1.2-0.1-1.4-1.3C6.2,7.9,9,7.6,10.3,8.4c2.4,1.5,1.5,4.8-2,5.4c-1.8,0.3-4.8-0.3-5.9-2.7c-0.4-0.9-0.3-0.7-0.3-0.7
c0.1,0.1,0.3,0.3,0.4,0.4c0.8,0.6,1.6,0.1,1.4-0.8C3.3,7.2,4.4,6.7,5.1,6.2s0.4-1.5-0.9-1.3c-1.9,0.3-2.4,3-2.4,3s-0.3-4.6,3.7-5
c4.1-0.4,4.7,3.2,6.5,3.7c2.5,0.8,1.3-2.6,1.3-2.6s1.1,1.7,0.6,3.2C13.5,8.2,12.3,8.5,11.3,8.2z"
/>
<defs>
<linearGradient
id=
"SVGID_1_"
gradientUnits=
"userSpaceOnUse"
x1=
"8"
y1=
"-271.1102"
x2=
"8"
y2=
"-257.1102"
gradientTransform=
"matrix(1 0 0 -1 0 -256.1102)"
>
<stop
offset=
"0"
style=
"stop-color:#445470"
/>
<stop
offset=
"1"
style=
"stop-color:#7A869A"
/>
</linearGradient>
</defs>
</svg>
doc/development/graphql_guide/pagination.md
View file @
f4d69149
...
...
@@ -338,9 +338,9 @@ describe 'sorting and pagination' do
let
(
:ordered_issues
)
{
issues
.
sort_by
(
&
:weight
)
}
it_behaves_like
'sorted paginated query'
do
let
(
:sort_param
)
{
:WEIGHT_ASC
}
let
(
:first_param
)
{
2
}
let
(
:
expected_result
s
)
{
ordered_issues
.
map
(
&
:iid
)
}
let
(
:sort_param
)
{
:WEIGHT_ASC
}
let
(
:first_param
)
{
2
}
let
(
:
all_record
s
)
{
ordered_issues
.
map
(
&
:iid
)
}
end
end
end
...
...
ee/app/assets/javascripts/integrations/zentao/issues_list/graphql/fragments/zentao_label.fragment.graphql
0 → 100644
View file @
f4d69149
fragment
ZentaoLabel
on
Label
{
title
name
color
textColor
}
ee/app/assets/javascripts/integrations/zentao/issues_list/graphql/fragments/zentao_user.fragment.graphql
0 → 100644
View file @
f4d69149
fragment
ZentaoUser
on
UserCore
{
avatarUrl
name
webUrl
}
ee/app/assets/javascripts/integrations/zentao/issues_list/graphql/queries/get_zentao_issues.query.graphql
0 → 100644
View file @
f4d69149
#import "../fragments/zentao_label.fragment.graphql"
#import "../fragments/zentao_user.fragment.graphql"
query
externalIssues
(
$issuesFetchPath
:
String
$search
:
String
$labels
:
String
$sort
:
String
$state
:
String
$page
:
Integer
)
{
externalIssues
(
issuesFetchPath
:
$issuesFetchPath
search
:
$search
labels
:
$labels
sort
:
$sort
state
:
$state
page
:
$page
)
@client
{
errors
pageInfo
{
total
page
}
nodes
{
id
projectId
createdAt
updatedAt
closedAt
title
webUrl
gitlabWebUrl
status
labels
{
...
ZentaoLabel
}
assignees
{
...
ZentaoUser
}
author
{
...
ZentaoUser
}
}
}
}
ee/app/assets/javascripts/integrations/zentao/issues_list/graphql/resolvers/zentao_issues.js
0 → 100644
View file @
f4d69149
import
{
DEFAULT_PAGE_SIZE
}
from
'
~/issuable_list/constants
'
;
import
{
i18n
}
from
'
~/issues_list/constants
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
{
convertObjectPropsToCamelCase
}
from
'
~/lib/utils/common_utils
'
;
const
transformZentaoIssueAssignees
=
(
zentaoIssue
)
=>
{
return
zentaoIssue
.
assignees
.
map
((
assignee
)
=>
({
__typename
:
'
UserCore
'
,
...
assignee
,
}));
};
const
transformZentaoIssueAuthor
=
(
zentaoIssue
,
authorId
)
=>
{
return
{
__typename
:
'
UserCore
'
,
...
zentaoIssue
.
author
,
id
:
authorId
,
};
};
const
transformZentaoIssueLabels
=
(
zentaoIssue
)
=>
{
return
zentaoIssue
.
labels
.
map
((
label
)
=>
({
__typename
:
'
Label
'
,
// eslint-disable-line @gitlab/require-i18n-strings
...
label
,
}));
};
const
transformZentaoIssuePageInfo
=
(
responseHeaders
=
{})
=>
{
return
{
__typename
:
'
ZentaoIssuesPageInfo
'
,
page
:
parseInt
(
responseHeaders
[
'
x-page
'
],
10
)
??
1
,
total
:
parseInt
(
responseHeaders
[
'
x-total
'
],
10
)
??
0
,
};
};
export
const
transformZentaoIssuesREST
=
(
response
)
=>
{
const
{
headers
,
data
:
zentaoIssues
}
=
response
;
return
{
__typename
:
'
ZentaoIssues
'
,
errors
:
[],
pageInfo
:
transformZentaoIssuePageInfo
(
headers
),
nodes
:
zentaoIssues
.
map
((
rawIssue
,
index
)
=>
{
const
zentaoIssue
=
convertObjectPropsToCamelCase
(
rawIssue
,
{
deep
:
true
});
return
{
__typename
:
'
ZentaoIssue
'
,
...
zentaoIssue
,
id
:
rawIssue
.
id
,
author
:
transformZentaoIssueAuthor
(
zentaoIssue
,
index
),
labels
:
transformZentaoIssueLabels
(
zentaoIssue
),
assignees
:
transformZentaoIssueAssignees
(
zentaoIssue
),
};
}),
};
};
export
default
function
zentaoIssuesResolver
(
_
,
{
issuesFetchPath
,
search
,
page
,
state
,
sort
,
labels
},
)
{
return
axios
.
get
(
issuesFetchPath
,
{
params
:
{
limit
:
DEFAULT_PAGE_SIZE
,
page
,
state
,
sort
,
labels
,
search
,
},
})
.
then
((
res
)
=>
{
return
transformZentaoIssuesREST
(
res
);
})
.
catch
((
error
)
=>
{
return
{
__typename
:
'
ZentaoIssues
'
,
errors
:
error
?.
response
?.
data
?.
errors
||
[
i18n
.
errorFetchingIssues
],
pageInfo
:
transformZentaoIssuePageInfo
(),
nodes
:
[],
};
});
}
ee/app/assets/javascripts/integrations/zentao/issues_list/zentao_issues_list_bundle.js
0 → 100644
View file @
f4d69149
import
externalIssuesListFactory
from
'
ee/external_issues_list
'
;
import
zentaoLogo
from
'
images/logos/zentao.svg
'
;
import
{
s__
}
from
'
~/locale
'
;
import
getIssuesQuery
from
'
./graphql/queries/get_zentao_issues.query.graphql
'
;
import
zentaoIssues
from
'
./graphql/resolvers/zentao_issues
'
;
export
default
externalIssuesListFactory
({
query
:
zentaoIssues
,
provides
:
{
getIssuesQuery
,
externalIssuesLogo
:
zentaoLogo
,
// This like below is passed to <gl-sprintf :message="%authorName in {}" />
// So we don't translate it since this should be a proper noun
externalIssueTrackerName
:
'
ZenTao
'
,
searchInputPlaceholderText
:
s__
(
'
Integrations|Search ZenTao issues
'
),
recentSearchesStorageKey
:
'
zentao_issues
'
,
createNewIssueText
:
s__
(
'
Integrations|Create new issue in ZenTao
'
),
logoContainerClass
:
'
logo-container
'
,
emptyStateNoIssueText
:
s__
(
'
Integrations|ZenTao issues display here when you create issues in your project in ZenTao.
'
,
),
},
});
ee/app/assets/javascripts/pages/projects/integrations/zentao/issues/index/index.js
0 → 100644
View file @
f4d69149
import
initZentaoIssuesList
from
'
ee/integrations/zentao/issues_list/zentao_issues_list_bundle
'
;
initZentaoIssuesList
({
mountPointSelector
:
'
.js-zentao-issues-list
'
});
ee/spec/frontend/integrations/zentao/issues_list/mock_data.js
0 → 100644
View file @
f4d69149
export
const
mockZentaoIssue1
=
{
project_id
:
1
,
id
:
1
,
title
:
'
Eius fuga voluptates.
'
,
created_at
:
'
2020-03-19T14:31:51.281Z
'
,
updated_at
:
'
2020-10-20T07:01:45.865Z
'
,
closed_at
:
null
,
status
:
'
Selected for Development
'
,
labels
:
[
{
title
:
'
backend
'
,
name
:
'
backend
'
,
color
:
'
#0052CC
'
,
text_color
:
'
#FFFFFF
'
,
},
],
author
:
{
name
:
'
jhope
'
,
web_url
:
'
https://gitlab-zentao.atlassian.net/people/5e32f803e127810e82875bc1
'
,
avatar_url
:
null
,
},
assignees
:
[
{
name
:
'
Kushal Pandya
'
,
web_url
:
'
https://gitlab-zentao.atlassian.net/people/1920938475
'
,
avatar_url
:
null
,
},
],
web_url
:
'
https://gitlab-zentao.atlassian.net/browse/IG-31596
'
,
gitlab_web_url
:
''
,
};
export
const
mockZentaoIssue2
=
{
project_id
:
1
,
id
:
2
,
title
:
'
Hic sit sint ducimus ea et sint.
'
,
created_at
:
'
2020-03-19T14:31:50.677Z
'
,
updated_at
:
'
2020-03-19T14:31:50.677Z
'
,
closed_at
:
null
,
status
:
'
Backlog
'
,
labels
:
[],
author
:
{
name
:
'
Gabe Weaver
'
,
web_url
:
'
https://gitlab-zentao.atlassian.net/people/5e320a31fe03e20c9d1dccde
'
,
avatar_url
:
null
,
},
assignees
:
[],
web_url
:
'
https://gitlab-zentao.atlassian.net/browse/IG-31595
'
,
gitlab_web_url
:
''
,
};
export
const
mockZentaoIssue3
=
{
project_id
:
1
,
id
:
3
,
title
:
'
Alias ut modi est labore.
'
,
created_at
:
'
2020-03-19T14:31:50.012Z
'
,
updated_at
:
'
2020-03-19T14:31:50.012Z
'
,
closed_at
:
null
,
status
:
'
Backlog
'
,
labels
:
[],
author
:
{
name
:
'
Gabe Weaver
'
,
web_url
:
'
https://gitlab-zentao.atlassian.net/people/5e320a31fe03e20c9d1dccde
'
,
avatar_url
:
null
,
},
assignees
:
[],
web_url
:
'
https://gitlab-zentao.atlassian.net/browse/IG-31594
'
,
gitlab_web_url
:
''
,
};
export
const
mockZentaoIssues
=
[
mockZentaoIssue1
,
mockZentaoIssue2
,
mockZentaoIssue3
];
ee/spec/frontend/integrations/zentao/issues_list/resolvers/zentao_issues_spec.js
0 → 100644
View file @
f4d69149
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
createApolloProvider
from
'
ee/external_issues_list/graphql
'
;
import
getZentaoIssues
from
'
ee/integrations/zentao/issues_list/graphql/queries/get_zentao_issues.query.graphql
'
;
import
zentaoIssuesResolver
from
'
ee/integrations/zentao/issues_list/graphql/resolvers/zentao_issues
'
;
import
{
DEFAULT_PAGE_SIZE
}
from
'
~/issuable_list/constants
'
;
import
{
i18n
}
from
'
~/issues_list/constants
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
{
mockZentaoIssues
}
from
'
../mock_data
'
;
const
DEFAULT_ISSUES_FETCH_PATH
=
'
/test/issues/fetch
'
;
const
DEFAULT_VARIABLES
=
{
issuesFetchPath
:
DEFAULT_ISSUES_FETCH_PATH
,
search
:
''
,
labels
:
''
,
sort
:
''
,
state
:
''
,
page
:
1
,
};
const
TEST_ERROR_RESPONSE
=
{
errors
:
[
'
lorem ipsum
'
]
};
const
TEST_PAGE_HEADERS
=
{
'
x-page
'
:
'
10
'
,
'
x-total
'
:
'
13
'
,
};
const
TYPE_ZENTAO_ISSUES
=
'
ZentaoIssues
'
;
describe
(
'
ee/integrations/zentao/issues_list/graphql/resolvers/zentao_issues
'
,
()
=>
{
let
mock
;
let
apolloClient
;
let
issuesApiSpy
;
const
createPageInfo
=
({
page
,
total
})
=>
({
__typename
:
'
ZentaoIssuesPageInfo
'
,
page
,
total
,
});
const
createUserCore
=
({
avatar_url
,
web_url
,
...
props
})
=>
({
__typename
:
'
UserCore
'
,
avatarUrl
:
avatar_url
,
webUrl
:
web_url
,
...
props
,
});
const
createLabel
=
({
text_color
,
...
props
})
=>
({
__typename
:
'
Label
'
,
textColor
:
text_color
,
...
props
,
});
const
createZentaoIssue
=
({
assignees
,
author
,
labels
,
closed_at
,
created_at
,
gitlab_web_url
,
updated_at
,
web_url
,
project_id
,
...
props
})
=>
({
__typename
:
'
ZentaoIssue
'
,
assignees
:
assignees
.
map
(
createUserCore
),
author
:
createUserCore
(
author
),
labels
:
labels
.
map
(
createLabel
),
closedAt
:
closed_at
,
createdAt
:
created_at
,
gitlabWebUrl
:
gitlab_web_url
,
updatedAt
:
updated_at
,
webUrl
:
web_url
,
projectId
:
project_id
,
...
props
,
});
const
query
=
(
variables
=
{})
=>
apolloClient
.
query
({
variables
:
{
...
DEFAULT_VARIABLES
,
...
variables
,
},
query
:
getZentaoIssues
,
});
beforeEach
(()
=>
{
issuesApiSpy
=
jest
.
fn
();
mock
=
new
MockAdapter
(
axios
);
mock
.
onGet
(
DEFAULT_ISSUES_FETCH_PATH
).
reply
((...
args
)
=>
issuesApiSpy
(...
args
));
({
defaultClient
:
apolloClient
}
=
createApolloProvider
(
zentaoIssuesResolver
));
});
afterEach
(()
=>
{
mock
.
restore
();
});
describe
.
each
`
desc | errorResponse | expectedErrors
${
'
when api request fails with data.errors
'
}
|
${
TEST_ERROR_RESPONSE
}
|
${
TEST_ERROR_RESPONSE
.
errors
}
${
'
when api request fails with unknown erorr
'
}
|
${{}}
|
$
{[
i18n
.
errorFetchingIssues
]}
`
(
'
$desc
'
,
({
errorResponse
,
expectedErrors
})
=>
{
beforeEach
(()
=>
{
issuesApiSpy
.
mockReturnValue
([
400
,
errorResponse
]);
});
it
(
'
returns error data
'
,
async
()
=>
{
const
response
=
await
query
();
expect
(
response
.
data
).
toEqual
({
externalIssues
:
{
__typename
:
TYPE_ZENTAO_ISSUES
,
errors
:
expectedErrors
,
pageInfo
:
createPageInfo
({
page
:
Number
.
NaN
,
total
:
Number
.
NaN
}),
nodes
:
[],
},
});
});
});
describe
(
'
with successful api request
'
,
()
=>
{
beforeEach
(()
=>
{
issuesApiSpy
.
mockReturnValue
([
200
,
mockZentaoIssues
,
TEST_PAGE_HEADERS
]);
});
it
(
'
sends expected params
'
,
async
()
=>
{
const
variables
=
{
search
:
'
test search
'
,
page
:
5
,
state
:
'
test state
'
,
sort
:
'
test sort
'
,
labels
:
'
test labels
'
,
};
expect
(
issuesApiSpy
).
not
.
toHaveBeenCalled
();
await
query
(
variables
);
expect
(
issuesApiSpy
).
toHaveBeenCalledWith
(
expect
.
objectContaining
({
params
:
{
limit
:
DEFAULT_PAGE_SIZE
,
...
variables
,
},
}),
);
});
it
(
'
returns transformed data
'
,
async
()
=>
{
const
response
=
await
query
();
expect
(
response
.
data
).
toEqual
({
externalIssues
:
{
__typename
:
TYPE_ZENTAO_ISSUES
,
errors
:
[],
pageInfo
:
createPageInfo
({
page
:
10
,
total
:
13
}),
nodes
:
mockZentaoIssues
.
map
(
createZentaoIssue
),
},
});
});
});
});
ee/spec/requests/api/graphql/boards/board_lists_query_spec.rb
View file @
f4d69149
...
...
@@ -90,9 +90,9 @@ RSpec.describe 'get board lists' do
context
'when ascending'
do
it_behaves_like
'sorted paginated query'
do
let
(
:sort_param
)
{
}
let
(
:first_param
)
{
2
}
let
(
:
expected_result
s
)
{
lists
.
map
{
|
list
|
global_id_of
(
list
)
}
}
let
(
:sort_param
)
{
}
let
(
:first_param
)
{
2
}
let
(
:
all_record
s
)
{
lists
.
map
{
|
list
|
global_id_of
(
list
)
}
}
end
end
end
...
...
ee/spec/requests/api/graphql/boards/epic_board_list_epics_query_spec.rb
View file @
f4d69149
...
...
@@ -43,7 +43,7 @@ RSpec.describe 'get list of epics for an epic board list' do
describe
'sorting and pagination'
do
let
(
:epic_fields
)
{
all_graphql_fields_for
(
'epics'
.
classify
)
}
let
(
:
expected_result
s
)
{
[
epic2
.
to_global_id
.
to_s
,
epic1
.
to_global_id
.
to_s
,
epic3
.
to_global_id
.
to_s
]
}
let
(
:
all_record
s
)
{
[
epic2
.
to_global_id
.
to_s
,
epic1
.
to_global_id
.
to_s
,
epic3
.
to_global_id
.
to_s
]
}
def
pagination_results_data
(
nodes
)
nodes
.
map
{
|
list
|
list
[
'id'
]
}
...
...
ee/spec/requests/api/graphql/boards/epic_boards_query_spec.rb
View file @
f4d69149
...
...
@@ -36,7 +36,7 @@ RSpec.describe 'get list of epic boards' do
describe
'sorting and pagination'
do
let
(
:data_path
)
{
[
:group
,
:epicBoards
]
}
let
(
:
expected_result
s
)
{
[
board2
.
to_global_id
.
to_s
,
board3
.
to_global_id
.
to_s
,
board1
.
to_global_id
.
to_s
]
}
let
(
:
all_record
s
)
{
[
board2
.
to_global_id
.
to_s
,
board3
.
to_global_id
.
to_s
,
board1
.
to_global_id
.
to_s
]
}
def
pagination_results_data
(
nodes
)
nodes
.
map
{
|
board
|
board
[
'id'
]
}
...
...
ee/spec/requests/api/graphql/boards/epic_lists_query_spec.rb
View file @
f4d69149
...
...
@@ -41,7 +41,7 @@ RSpec.describe 'get list of epic boards' do
describe
'sorting and pagination'
do
let
(
:data_path
)
{
[
:group
,
:epicBoard
,
:lists
]
}
let
(
:
expected_result
s
)
{
[
list3
.
to_global_id
.
to_s
,
list1
.
to_global_id
.
to_s
,
list2
.
to_global_id
.
to_s
]
}
let
(
:
all_record
s
)
{
[
list3
.
to_global_id
.
to_s
,
list1
.
to_global_id
.
to_s
,
list2
.
to_global_id
.
to_s
]
}
def
pagination_results_data
(
nodes
)
nodes
.
map
{
|
list
|
list
[
'id'
]
}
...
...
ee/spec/requests/api/graphql/group/epic/epic_issues_spec.rb
View file @
f4d69149
...
...
@@ -89,7 +89,7 @@ RSpec.describe 'Getting issues for an epic' do
let
(
:current_user
)
{
user
}
let
(
:sort_param
)
{
}
let
(
:first_param
)
{
1
}
let
(
:
expected_result
s
)
{
[
issue
,
confidential_issue
].
map
{
|
i
|
global_id_of
(
i
)
}
}
let
(
:
all_record
s
)
{
[
issue
,
confidential_issue
].
map
{
|
i
|
global_id_of
(
i
)
}
}
end
end
end
...
...
ee/spec/requests/api/graphql/group/epics_spec.rb
View file @
f4d69149
...
...
@@ -99,7 +99,7 @@ RSpec.describe 'Epics through GroupQuery' do
it_behaves_like
'sorted paginated query'
,
is_reversible:
true
do
let
(
:sort_param
)
{
:start_date_asc
}
let
(
:first_param
)
{
2
}
let
(
:
expected_result
s
)
{
global_ids
(
epic4
,
epic3
,
epic2
,
epic
)
}
let
(
:
all_record
s
)
{
global_ids
(
epic4
,
epic3
,
epic2
,
epic
)
}
end
end
...
...
@@ -107,7 +107,7 @@ RSpec.describe 'Epics through GroupQuery' do
it_behaves_like
'sorted paginated query'
,
is_reversible:
true
do
let
(
:sort_param
)
{
:start_date_desc
}
let
(
:first_param
)
{
2
}
let
(
:
expected_result
s
)
{
global_ids
(
epic
,
epic2
,
epic3
,
epic4
)
}
let
(
:
all_record
s
)
{
global_ids
(
epic
,
epic2
,
epic3
,
epic4
)
}
end
end
...
...
@@ -115,7 +115,7 @@ RSpec.describe 'Epics through GroupQuery' do
it_behaves_like
'sorted paginated query'
,
is_reversible:
true
do
let
(
:sort_param
)
{
:end_date_asc
}
let
(
:first_param
)
{
2
}
let
(
:
expected_result
s
)
{
global_ids
(
epic3
,
epic4
,
epic
,
epic2
)
}
let
(
:
all_record
s
)
{
global_ids
(
epic3
,
epic4
,
epic
,
epic2
)
}
end
end
...
...
@@ -123,7 +123,7 @@ RSpec.describe 'Epics through GroupQuery' do
it_behaves_like
'sorted paginated query'
,
is_reversible:
true
do
let
(
:sort_param
)
{
:end_date_desc
}
let
(
:first_param
)
{
2
}
let
(
:
expected_result
s
)
{
global_ids
(
epic2
,
epic
,
epic4
,
epic3
)
}
let
(
:
all_record
s
)
{
global_ids
(
epic2
,
epic
,
epic4
,
epic3
)
}
end
end
end
...
...
ee/spec/requests/api/graphql/group_query_spec.rb
View file @
f4d69149
...
...
@@ -367,7 +367,7 @@ RSpec.describe 'getting group information' do
let
(
:node_path
)
{
[
'averageCoverage'
]
}
let
(
:sort_param
)
{
}
let
(
:first_param
)
{
2
}
let
(
:
expected_result
s
)
{
[
cov_1
,
cov_2
,
cov_3
,
cov_4
,
cov_5
].
reverse
.
map
(
&
:coverage
)
}
let
(
:
all_record
s
)
{
[
cov_1
,
cov_2
,
cov_3
,
cov_4
,
cov_5
].
reverse
.
map
(
&
:coverage
)
}
end
end
end
...
...
ee/spec/requests/api/graphql/namespace/projects_spec.rb
View file @
f4d69149
...
...
@@ -37,9 +37,9 @@ RSpec.describe 'Namespace.projects' do
it_behaves_like
'sorted paginated query'
do
let
(
:node_path
)
{
%w[name]
}
let
(
:sort_param
)
{
:STORAGE
}
let
(
:first_param
)
{
2
}
let
(
:
expected_result
s
)
{
[
project_4
,
project_2
,
project_3
].
map
(
&
:name
)
}
let
(
:sort_param
)
{
:STORAGE
}
let
(
:first_param
)
{
2
}
let
(
:
all_record
s
)
{
[
project_4
,
project_2
,
project_3
].
map
(
&
:name
)
}
end
end
end
...
...
ee/spec/requests/api/graphql/project/dast_profiles_spec.rb
View file @
f4d69149
...
...
@@ -69,7 +69,7 @@ RSpec.describe 'Query.project(fullPath).dastProfiles' do
let
(
:sort_param
)
{
nil
}
let
(
:first_param
)
{
3
}
let
(
:
expected_result
s
)
do
let
(
:
all_record
s
)
do
[
dast_profile4
,
dast_profile3
,
dast_profile2
,
dast_profile1
].
map
{
|
validation
|
global_id_of
(
validation
)}
end
end
...
...
ee/spec/requests/api/graphql/project/dast_site_validations_spec.rb
View file @
f4d69149
...
...
@@ -71,7 +71,7 @@ RSpec.describe 'Query.project(fullPath).dastSiteValidations' do
let
(
:sort_param
)
{
nil
}
let
(
:first_param
)
{
3
}
let
(
:
expected_result
s
)
do
let
(
:
all_record
s
)
do
[
dast_site_validation4
,
dast_site_validation3
,
...
...
ee/spec/requests/api/graphql/project/issues_spec.rb
View file @
f4d69149
...
...
@@ -26,19 +26,19 @@ RSpec.describe 'getting an issue list for a project' do
context
'when ascending'
do
it_behaves_like
'sorted paginated query'
do
let
(
:node_path
)
{
%w[iid]
}
let
(
:sort_param
)
{
:WEIGHT_ASC
}
let
(
:first_param
)
{
2
}
let
(
:
expected_result
s
)
{
[
weight_issue3
,
weight_issue5
,
weight_issue1
,
weight_issue4
,
weight_issue2
].
map
{
|
i
|
i
.
iid
.
to_s
}
}
let
(
:node_path
)
{
%w[iid]
}
let
(
:sort_param
)
{
:WEIGHT_ASC
}
let
(
:first_param
)
{
2
}
let
(
:
all_record
s
)
{
[
weight_issue3
,
weight_issue5
,
weight_issue1
,
weight_issue4
,
weight_issue2
].
map
{
|
i
|
i
.
iid
.
to_s
}
}
end
end
context
'when descending'
do
it_behaves_like
'sorted paginated query'
do
let
(
:node_path
)
{
%w[iid]
}
let
(
:sort_param
)
{
:WEIGHT_DESC
}
let
(
:first_param
)
{
2
}
let
(
:
expected_result
s
)
{
[
weight_issue1
,
weight_issue5
,
weight_issue3
,
weight_issue4
,
weight_issue2
].
map
{
|
i
|
i
.
iid
.
to_s
}
}
let
(
:node_path
)
{
%w[iid]
}
let
(
:sort_param
)
{
:WEIGHT_DESC
}
let
(
:first_param
)
{
2
}
let
(
:
all_record
s
)
{
[
weight_issue1
,
weight_issue5
,
weight_issue3
,
weight_issue4
,
weight_issue2
].
map
{
|
i
|
i
.
iid
.
to_s
}
}
end
end
end
...
...
ee/spec/requests/api/graphql/project/requirements_management/requirements_spec.rb
View file @
f4d69149
...
...
@@ -206,17 +206,17 @@ RSpec.describe 'getting a requirement list for a project' do
context
'when ascending'
do
it_behaves_like
'sorted paginated query'
do
let
(
:sort_param
)
{
:CREATED_ASC
}
let
(
:first_param
)
{
2
}
let
(
:
expected_result
s
)
{
[
requirement4
.
iid
,
requirement3
.
iid
,
requirement5
.
iid
,
requirement1
.
iid
,
requirement2
.
iid
]
}
let
(
:sort_param
)
{
:CREATED_ASC
}
let
(
:first_param
)
{
2
}
let
(
:
all_record
s
)
{
[
requirement4
.
iid
,
requirement3
.
iid
,
requirement5
.
iid
,
requirement1
.
iid
,
requirement2
.
iid
]
}
end
end
context
'when descending'
do
it_behaves_like
'sorted paginated query'
do
let
(
:sort_param
)
{
:CREATED_DESC
}
let
(
:first_param
)
{
2
}
let
(
:
expected_result
s
)
{
[
requirement2
.
iid
,
requirement1
.
iid
,
requirement5
.
iid
,
requirement3
.
iid
,
requirement4
.
iid
]
}
let
(
:sort_param
)
{
:CREATED_DESC
}
let
(
:first_param
)
{
2
}
let
(
:
all_record
s
)
{
[
requirement2
.
iid
,
requirement1
.
iid
,
requirement5
.
iid
,
requirement3
.
iid
,
requirement4
.
iid
]
}
end
end
end
...
...
ee/spec/requests/api/graphql/project/requirements_management/test_reports_spec.rb
View file @
f4d69149
...
...
@@ -55,8 +55,8 @@ RSpec.describe 'getting test reports of a requirement' do
post_graphql
(
query
,
current_user:
current_user
)
test_reports_ids
=
test_reports_data
.
map
{
|
result
|
result
[
'node'
][
'id'
]
}
expected_result
s
=
[
test_report_1
.
to_global_id
.
to_s
,
test_report_2
.
to_global_id
.
to_s
]
expect
(
test_reports_ids
).
to
match_array
(
expected_result
s
)
all_record
s
=
[
test_report_1
.
to_global_id
.
to_s
,
test_report_2
.
to_global_id
.
to_s
]
expect
(
test_reports_ids
).
to
match_array
(
all_record
s
)
end
context
'with pagination'
do
...
...
@@ -76,7 +76,7 @@ RSpec.describe 'getting test reports of a requirement' do
it_behaves_like
'sorted paginated query'
do
let
(
:sort_param
)
{
:CREATED_ASC
}
let
(
:first_param
)
{
2
}
let
(
:
expected_result
s
)
do
let
(
:
all_record
s
)
do
in_creation_order
.
map
{
|
r
|
global_id_of
(
r
)
}
end
end
...
...
@@ -84,7 +84,7 @@ RSpec.describe 'getting test reports of a requirement' do
it_behaves_like
'sorted paginated query'
do
let
(
:sort_param
)
{
:CREATED_DESC
}
let
(
:first_param
)
{
2
}
let
(
:
expected_result
s
)
do
let
(
:
all_record
s
)
do
in_creation_order
.
reverse
.
map
{
|
r
|
global_id_of
(
r
)
}
end
end
...
...
locale/gitlab.pot
View file @
f4d69149
...
...
@@ -18223,6 +18223,9 @@ msgstr ""
msgid "Integrations|Create new issue in Jira"
msgstr ""
msgid "Integrations|Create new issue in ZenTao"
msgstr ""
msgid "Integrations|Default settings are inherited from the group level."
msgstr ""
...
...
@@ -18316,6 +18319,9 @@ msgstr ""
msgid "Integrations|Search Jira issues"
msgstr ""
msgid "Integrations|Search ZenTao issues"
msgstr ""
msgid "Integrations|Send notifications about project events to Unify Circuit."
msgstr ""
...
...
@@ -18361,6 +18367,9 @@ msgstr ""
msgid "Integrations|You've activated every integration 🎉"
msgstr ""
msgid "Integrations|ZenTao issues display here when you create issues in your project in ZenTao."
msgstr ""
msgid "Interactive mode"
msgstr ""
...
...
spec/requests/api/graphql/boards/board_lists_query_spec.rb
View file @
f4d69149
...
...
@@ -92,9 +92,9 @@ RSpec.describe 'get board lists' do
context
'when ascending'
do
it_behaves_like
'sorted paginated query'
do
let
(
:sort_param
)
{
}
let
(
:first_param
)
{
2
}
let
(
:
expected_result
s
)
{
lists
.
map
{
|
list
|
global_id_of
(
list
)
}
}
let
(
:sort_param
)
{
}
let
(
:first_param
)
{
2
}
let
(
:
all_record
s
)
{
lists
.
map
{
|
list
|
global_id_of
(
list
)
}
}
end
end
end
...
...
spec/requests/api/graphql/ci/runners_spec.rb
View file @
f4d69149
...
...
@@ -95,9 +95,9 @@ RSpec.describe 'Query.runners' do
let
(
:ordered_runners
)
{
runners
.
sort_by
(
&
:contacted_at
)
}
it_behaves_like
'sorted paginated query'
do
let
(
:sort_param
)
{
:CONTACTED_ASC
}
let
(
:first_param
)
{
2
}
let
(
:
expected_result
s
)
{
ordered_runners
.
map
(
&
:id
)
}
let
(
:sort_param
)
{
:CONTACTED_ASC
}
let
(
:first_param
)
{
2
}
let
(
:
all_record
s
)
{
ordered_runners
.
map
(
&
:id
)
}
end
end
...
...
@@ -105,9 +105,9 @@ RSpec.describe 'Query.runners' do
let
(
:ordered_runners
)
{
runners
.
sort_by
(
&
:created_at
).
reverse
}
it_behaves_like
'sorted paginated query'
do
let
(
:sort_param
)
{
:CREATED_DESC
}
let
(
:first_param
)
{
2
}
let
(
:
expected_result
s
)
{
ordered_runners
.
map
(
&
:id
)
}
let
(
:sort_param
)
{
:CREATED_DESC
}
let
(
:first_param
)
{
2
}
let
(
:
all_record
s
)
{
ordered_runners
.
map
(
&
:id
)
}
end
end
end
...
...
spec/requests/api/graphql/namespace/projects_spec.rb
View file @
f4d69149
...
...
@@ -106,10 +106,10 @@ RSpec.describe 'getting projects' do
context
'when sorting by similarity'
do
it_behaves_like
'sorted paginated query'
do
let
(
:node_path
)
{
%w[name]
}
let
(
:sort_param
)
{
:SIMILARITY
}
let
(
:first_param
)
{
2
}
let
(
:
expected_result
s
)
{
[
project_3
.
name
,
project_2
.
name
,
project_4
.
name
]
}
let
(
:node_path
)
{
%w[name]
}
let
(
:sort_param
)
{
:SIMILARITY
}
let
(
:first_param
)
{
2
}
let
(
:
all_record
s
)
{
[
project_3
.
name
,
project_2
.
name
,
project_4
.
name
]
}
end
end
end
...
...
spec/requests/api/graphql/project/container_repositories_spec.rb
View file @
f4d69149
...
...
@@ -190,7 +190,7 @@ RSpec.describe 'getting container repositories in a project' do
it_behaves_like
'sorted paginated query'
do
let
(
:sort_param
)
{
:NAME_ASC
}
let
(
:first_param
)
{
2
}
let
(
:
expected_result
s
)
{
[
container_repository2
.
name
,
container_repository1
.
name
,
container_repository4
.
name
,
container_repository3
.
name
,
container_repository5
.
name
]
}
let
(
:
all_record
s
)
{
[
container_repository2
.
name
,
container_repository1
.
name
,
container_repository4
.
name
,
container_repository3
.
name
,
container_repository5
.
name
]
}
end
end
...
...
@@ -198,7 +198,7 @@ RSpec.describe 'getting container repositories in a project' do
it_behaves_like
'sorted paginated query'
do
let
(
:sort_param
)
{
:NAME_DESC
}
let
(
:first_param
)
{
2
}
let
(
:
expected_result
s
)
{
[
container_repository5
.
name
,
container_repository3
.
name
,
container_repository4
.
name
,
container_repository1
.
name
,
container_repository2
.
name
]
}
let
(
:
all_record
s
)
{
[
container_repository5
.
name
,
container_repository3
.
name
,
container_repository4
.
name
,
container_repository1
.
name
,
container_repository2
.
name
]
}
end
end
end
...
...
spec/requests/api/graphql/project/issues_spec.rb
View file @
f4d69149
...
...
@@ -205,7 +205,7 @@ RSpec.describe 'getting an issue list for a project' do
it_behaves_like
'sorted paginated query'
do
let
(
:sort_param
)
{
:DUE_DATE_ASC
}
let
(
:first_param
)
{
2
}
let
(
:
expected_result
s
)
{
[
due_issue3
.
iid
,
due_issue5
.
iid
,
due_issue1
.
iid
,
due_issue4
.
iid
,
due_issue2
.
iid
]
}
let
(
:
all_record
s
)
{
[
due_issue3
.
iid
,
due_issue5
.
iid
,
due_issue1
.
iid
,
due_issue4
.
iid
,
due_issue2
.
iid
]
}
end
end
...
...
@@ -213,7 +213,7 @@ RSpec.describe 'getting an issue list for a project' do
it_behaves_like
'sorted paginated query'
do
let
(
:sort_param
)
{
:DUE_DATE_DESC
}
let
(
:first_param
)
{
2
}
let
(
:
expected_result
s
)
{
[
due_issue1
.
iid
,
due_issue5
.
iid
,
due_issue3
.
iid
,
due_issue4
.
iid
,
due_issue2
.
iid
]
}
let
(
:
all_record
s
)
{
[
due_issue1
.
iid
,
due_issue5
.
iid
,
due_issue3
.
iid
,
due_issue4
.
iid
,
due_issue2
.
iid
]
}
end
end
end
...
...
@@ -230,7 +230,7 @@ RSpec.describe 'getting an issue list for a project' do
it_behaves_like
'sorted paginated query'
do
let
(
:sort_param
)
{
:RELATIVE_POSITION_ASC
}
let
(
:first_param
)
{
2
}
let
(
:
expected_result
s
)
do
let
(
:
all_record
s
)
do
[
relative_issue5
.
iid
,
relative_issue3
.
iid
,
relative_issue1
.
iid
,
relative_issue4
.
iid
,
relative_issue2
.
iid
...
...
@@ -256,7 +256,7 @@ RSpec.describe 'getting an issue list for a project' do
it_behaves_like
'sorted paginated query'
do
let
(
:sort_param
)
{
:PRIORITY_ASC
}
let
(
:first_param
)
{
2
}
let
(
:
expected_result
s
)
do
let
(
:
all_record
s
)
do
[
priority_issue3
.
iid
,
priority_issue1
.
iid
,
priority_issue2
.
iid
,
priority_issue4
.
iid
...
...
@@ -269,7 +269,7 @@ RSpec.describe 'getting an issue list for a project' do
it_behaves_like
'sorted paginated query'
do
let
(
:sort_param
)
{
:PRIORITY_DESC
}
let
(
:first_param
)
{
2
}
let
(
:
expected_result
s
)
do
let
(
:
all_record
s
)
do
[
priority_issue1
.
iid
,
priority_issue3
.
iid
,
priority_issue2
.
iid
,
priority_issue4
.
iid
]
end
end
...
...
@@ -288,17 +288,17 @@ RSpec.describe 'getting an issue list for a project' do
context
'when ascending'
do
it_behaves_like
'sorted paginated query'
do
let
(
:sort_param
)
{
:LABEL_PRIORITY_ASC
}
let
(
:first_param
)
{
2
}
let
(
:
expected_result
s
)
{
[
label_issue3
.
iid
,
label_issue1
.
iid
,
label_issue2
.
iid
,
label_issue4
.
iid
]
}
let
(
:sort_param
)
{
:LABEL_PRIORITY_ASC
}
let
(
:first_param
)
{
2
}
let
(
:
all_record
s
)
{
[
label_issue3
.
iid
,
label_issue1
.
iid
,
label_issue2
.
iid
,
label_issue4
.
iid
]
}
end
end
context
'when descending'
do
it_behaves_like
'sorted paginated query'
do
let
(
:sort_param
)
{
:LABEL_PRIORITY_DESC
}
let
(
:first_param
)
{
2
}
let
(
:
expected_result
s
)
{
[
label_issue2
.
iid
,
label_issue3
.
iid
,
label_issue1
.
iid
,
label_issue4
.
iid
]
}
let
(
:sort_param
)
{
:LABEL_PRIORITY_DESC
}
let
(
:first_param
)
{
2
}
let
(
:
all_record
s
)
{
[
label_issue2
.
iid
,
label_issue3
.
iid
,
label_issue1
.
iid
,
label_issue4
.
iid
]
}
end
end
end
...
...
@@ -313,17 +313,17 @@ RSpec.describe 'getting an issue list for a project' do
context
'when ascending'
do
it_behaves_like
'sorted paginated query'
do
let
(
:sort_param
)
{
:MILESTONE_DUE_ASC
}
let
(
:first_param
)
{
2
}
let
(
:
expected_result
s
)
{
[
milestone_issue2
.
iid
,
milestone_issue3
.
iid
,
milestone_issue1
.
iid
]
}
let
(
:sort_param
)
{
:MILESTONE_DUE_ASC
}
let
(
:first_param
)
{
2
}
let
(
:
all_record
s
)
{
[
milestone_issue2
.
iid
,
milestone_issue3
.
iid
,
milestone_issue1
.
iid
]
}
end
end
context
'when descending'
do
it_behaves_like
'sorted paginated query'
do
let
(
:sort_param
)
{
:MILESTONE_DUE_DESC
}
let
(
:first_param
)
{
2
}
let
(
:
expected_result
s
)
{
[
milestone_issue3
.
iid
,
milestone_issue2
.
iid
,
milestone_issue1
.
iid
]
}
let
(
:sort_param
)
{
:MILESTONE_DUE_DESC
}
let
(
:first_param
)
{
2
}
let
(
:
all_record
s
)
{
[
milestone_issue3
.
iid
,
milestone_issue2
.
iid
,
milestone_issue1
.
iid
]
}
end
end
end
...
...
spec/requests/api/graphql/project/merge_requests_spec.rb
View file @
f4d69149
...
...
@@ -385,7 +385,7 @@ RSpec.describe 'getting merge request listings nested in a project' do
context
'when sorting by merged_at DESC'
do
let
(
:sort_param
)
{
:MERGED_AT_DESC
}
let
(
:
expected_result
s
)
do
let
(
:
all_record
s
)
do
[
merge_request_b
,
merge_request_d
,
...
...
@@ -418,14 +418,14 @@ RSpec.describe 'getting merge request listings nested in a project' do
query
=
pagination_query
(
params
)
post_graphql
(
query
,
current_user:
current_user
)
expect
(
results
.
map
{
|
item
|
item
[
"id"
]
}).
to
eq
(
expected_result
s
.
last
(
2
))
expect
(
results
.
map
{
|
item
|
item
[
"id"
]
}).
to
eq
(
all_record
s
.
last
(
2
))
end
end
end
context
'when sorting by closed_at DESC'
do
let
(
:sort_param
)
{
:CLOSED_AT_DESC
}
let
(
:
expected_result
s
)
do
let
(
:
all_record
s
)
do
[
merge_request_b
,
merge_request_d
,
...
...
@@ -458,7 +458,7 @@ RSpec.describe 'getting merge request listings nested in a project' do
query
=
pagination_query
(
params
)
post_graphql
(
query
,
current_user:
current_user
)
expect
(
results
.
map
{
|
item
|
item
[
"id"
]
}).
to
eq
(
expected_result
s
.
last
(
2
))
expect
(
results
.
map
{
|
item
|
item
[
"id"
]
}).
to
eq
(
all_record
s
.
last
(
2
))
end
end
end
...
...
spec/requests/api/graphql/project/releases_spec.rb
View file @
f4d69149
...
...
@@ -322,17 +322,17 @@ RSpec.describe 'Query.project(fullPath).releases()' do
context
'when ascending'
do
it_behaves_like
'sorted paginated query'
do
let
(
:sort_param
)
{
:RELEASED_AT_ASC
}
let
(
:first_param
)
{
2
}
let
(
:
expected_result
s
)
{
[
release1
.
tag
,
release2
.
tag
,
release3
.
tag
,
release4
.
tag
,
release5
.
tag
]
}
let
(
:sort_param
)
{
:RELEASED_AT_ASC
}
let
(
:first_param
)
{
2
}
let
(
:
all_record
s
)
{
[
release1
.
tag
,
release2
.
tag
,
release3
.
tag
,
release4
.
tag
,
release5
.
tag
]
}
end
end
context
'when descending'
do
it_behaves_like
'sorted paginated query'
do
let
(
:sort_param
)
{
:RELEASED_AT_DESC
}
let
(
:first_param
)
{
2
}
let
(
:
expected_result
s
)
{
[
release5
.
tag
,
release4
.
tag
,
release3
.
tag
,
release2
.
tag
,
release1
.
tag
]
}
let
(
:sort_param
)
{
:RELEASED_AT_DESC
}
let
(
:first_param
)
{
2
}
let
(
:
all_record
s
)
{
[
release5
.
tag
,
release4
.
tag
,
release3
.
tag
,
release2
.
tag
,
release1
.
tag
]
}
end
end
end
...
...
@@ -346,17 +346,17 @@ RSpec.describe 'Query.project(fullPath).releases()' do
context
'when ascending'
do
it_behaves_like
'sorted paginated query'
do
let
(
:sort_param
)
{
:CREATED_ASC
}
let
(
:first_param
)
{
2
}
let
(
:
expected_result
s
)
{
[
release1
.
tag
,
release2
.
tag
,
release3
.
tag
,
release4
.
tag
,
release5
.
tag
]
}
let
(
:sort_param
)
{
:CREATED_ASC
}
let
(
:first_param
)
{
2
}
let
(
:
all_record
s
)
{
[
release1
.
tag
,
release2
.
tag
,
release3
.
tag
,
release4
.
tag
,
release5
.
tag
]
}
end
end
context
'when descending'
do
it_behaves_like
'sorted paginated query'
do
let
(
:sort_param
)
{
:CREATED_DESC
}
let
(
:first_param
)
{
2
}
let
(
:
expected_result
s
)
{
[
release5
.
tag
,
release4
.
tag
,
release3
.
tag
,
release2
.
tag
,
release1
.
tag
]
}
let
(
:sort_param
)
{
:CREATED_DESC
}
let
(
:first_param
)
{
2
}
let
(
:
all_record
s
)
{
[
release5
.
tag
,
release4
.
tag
,
release3
.
tag
,
release2
.
tag
,
release1
.
tag
]
}
end
end
end
...
...
spec/requests/api/graphql/users_spec.rb
View file @
f4d69149
...
...
@@ -114,17 +114,17 @@ RSpec.describe 'Users' do
context
'when ascending'
do
it_behaves_like
'sorted paginated query'
do
let
(
:sort_param
)
{
:CREATED_ASC
}
let
(
:first_param
)
{
1
}
let
(
:
expected_result
s
)
{
ascending_users
}
let
(
:sort_param
)
{
:CREATED_ASC
}
let
(
:first_param
)
{
1
}
let
(
:
all_record
s
)
{
ascending_users
}
end
end
context
'when descending'
do
it_behaves_like
'sorted paginated query'
do
let
(
:sort_param
)
{
:CREATED_DESC
}
let
(
:first_param
)
{
1
}
let
(
:
expected_result
s
)
{
ascending_users
.
reverse
}
let
(
:sort_param
)
{
:CREATED_DESC
}
let
(
:first_param
)
{
1
}
let
(
:
all_record
s
)
{
ascending_users
.
reverse
}
end
end
end
...
...
spec/support/shared_examples/graphql/sorted_paginated_query_shared_examples.rb
View file @
f4d69149
...
...
@@ -9,7 +9,7 @@
# data_path: the keys necessary to dig into the return GraphQL data to get the
# returned results
# first_param: number of items expected (like a page size)
#
expected_result
s: array of comparison data of all items sorted correctly
#
all_record
s: array of comparison data of all items sorted correctly
# pagination_query: method that specifies the GraphQL query
# pagination_results_data: method that extracts the sorted data used to compare against
# the expected results
...
...
@@ -38,9 +38,9 @@
# let(:ordered_issues) { issues.sort_by(&:weight) }
#
# it_behaves_like 'sorted paginated query' do
# let(:sort_param)
{ :WEIGHT_ASC }
# let(:first_param)
{ 2 }
# let(:
expected_result
s) { ordered_issues.map(&:iid) }
# let(:sort_param) { :WEIGHT_ASC }
# let(:first_param) { 2 }
# let(:
all_record
s) { ordered_issues.map(&:iid) }
# end
# end
#
...
...
@@ -51,7 +51,7 @@ RSpec.shared_examples 'sorted paginated query' do |conditions = {}|
let
(
:node_path
)
{
[
'id'
]
}
it_behaves_like
'requires variables'
do
let
(
:required_variables
)
{
[
:sort_param
,
:first_param
,
:
expected_result
s
,
:data_path
,
:current_user
]
}
let
(
:required_variables
)
{
[
:sort_param
,
:first_param
,
:
all_record
s
,
:data_path
,
:current_user
]
}
end
describe
do
...
...
@@ -101,13 +101,13 @@ RSpec.shared_examples 'sorted paginated query' do |conditions = {}|
context
'when sorting'
do
it
'sorts correctly'
do
expect
(
results
).
to
eq
expected_result
s
expect
(
results
).
to
eq
all_record
s
end
context
'when paginating'
do
let
(
:params
)
{
sort_argument
.
merge
(
first:
first_param
)
}
let
(
:first_page
)
{
expected_result
s
.
first
(
first_param
)
}
let
(
:rest
)
{
expected_result
s
.
drop
(
first_param
)
}
let
(
:first_page
)
{
all_record
s
.
first
(
first_param
)
}
let
(
:rest
)
{
all_record
s
.
drop
(
first_param
)
}
it
'paginates correctly'
do
expect
(
results
).
to
eq
first_page
...
...
@@ -130,7 +130,7 @@ RSpec.shared_examples 'sorted paginated query' do |conditions = {}|
it
'fetches last elements without error'
do
post_graphql
(
pagination_query
(
params
),
current_user:
current_user
)
expect
(
results
.
first
).
to
eq
(
expected_result
s
.
last
)
expect
(
results
.
first
).
to
eq
(
all_record
s
.
last
)
end
end
end
...
...
spec/support/shared_examples/requests/api/graphql/group_and_project_boards_query_shared_examples.rb
View file @
f4d69149
...
...
@@ -62,9 +62,10 @@ RSpec.shared_examples 'group and project boards query' do
context
'when ascending'
do
it_behaves_like
'sorted paginated query'
do
let
(
:sort_param
)
{
}
let
(
:first_param
)
{
2
}
let
(
:expected_results
)
do
let
(
:sort_param
)
{
}
let
(
:first_param
)
{
2
}
let
(
:all_records
)
do
if
board_parent
.
multiple_issue_boards_available?
boards
.
map
{
|
board
|
global_id_of
(
board
)
}
else
...
...
spec/support/shared_examples/requests/api/graphql/packages/group_and_project_packages_list_shared_examples.rb
View file @
f4d69149
...
...
@@ -101,7 +101,7 @@ RSpec.shared_examples 'group and project packages query' do
it_behaves_like
'sorted paginated query'
do
let
(
:sort_param
)
{
order
}
let
(
:first_param
)
{
4
}
let
(
:
expected_result
s
)
{
ascending_packages
}
let
(
:
all_record
s
)
{
ascending_packages
}
end
end
end
...
...
@@ -111,7 +111,7 @@ RSpec.shared_examples 'group and project packages query' do
it_behaves_like
'sorted paginated query'
do
let
(
:sort_param
)
{
order
}
let
(
:first_param
)
{
4
}
let
(
:
expected_result
s
)
{
ascending_packages
.
reverse
}
let
(
:
all_record
s
)
{
ascending_packages
.
reverse
}
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment