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:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-10-11 18:10:03 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-10-11 18:10:03 +0300
commit14ae125e1c59ca3e9b535938707831c986dbbc43 (patch)
tree6cb2244b7aafe63586d5e1c538ab8e1385db4163 /spec/support_specs
parentfd31bd1fc7954f69025d8e6bbe7f772ea9fb4bb0 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support_specs')
-rw-r--r--spec/support_specs/helpers/graphql_helpers_spec.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/support_specs/helpers/graphql_helpers_spec.rb b/spec/support_specs/helpers/graphql_helpers_spec.rb
index c02e4adf983..12a6e561257 100644
--- a/spec/support_specs/helpers/graphql_helpers_spec.rb
+++ b/spec/support_specs/helpers/graphql_helpers_spec.rb
@@ -133,6 +133,23 @@ RSpec.describe GraphqlHelpers do
expect(graphql_dig_at(data, :foo, :nodes, :bar, :nodes, :id)).to eq([nil, 2, 3, nil])
end
+
+ it 'supports fields with leading underscore' do
+ web_path = '/namespace1/project1/-/packages/997'
+ data = {
+ 'packages' => {
+ 'nodes' => [
+ {
+ '_links' => {
+ 'webPath' => web_path
+ }
+ }
+ ]
+ }
+ }
+
+ expect(graphql_dig_at(data, :packages, :nodes, :_links, :web_path)).to match_array([web_path])
+ end
end
describe 'var' do
@@ -417,4 +434,22 @@ RSpec.describe GraphqlHelpers do
end
end
end
+
+ describe '.fieldnamerize' do
+ subject { described_class.fieldnamerize(field) }
+
+ let(:field) { 'merge_request' }
+
+ it 'makes an underscored string look like a fieldname' do
+ is_expected.to eq('mergeRequest')
+ end
+
+ context 'when field has a leading underscore' do
+ let(:field) { :_links }
+
+ it 'skips a transformation' do
+ is_expected.to eq('_links')
+ end
+ end
+ end
end