Commit 3011b423 authored by George Koltsov's avatar George Koltsov

Update GraphqlExtractor return value to be original hash

- A bug was introduced in
  https://gitlab.com/gitlab-org/gitlab/-/merge_requests/50951
  with addition of `Array.wrap`, which caused return value of
  `GraphqlExtractor`, an enumerator, to be wrapped in an Array,
  which caused exception to be raised in `HashKeyDigger`
- Update return value of `GraphqlExtractor` to be original hash
  instead of wrapping it in an enumerator, there is no need for it
parent 19a72b14
---
title: Update GraphqlExtractor return value to be original hash
merge_request: 51596
author:
type: fixed
......@@ -11,14 +11,10 @@ module BulkImports
def extract(context)
client = graphql_client(context)
Enumerator.new do |yielder|
result = client.execute(
client.parse(query.to_s),
query.variables(context.entity)
)
yielder << result.original_hash.deep_dup
end
client.execute(
client.parse(query.to_s),
query.variables(context.entity)
).original_hash.deep_dup
end
private
......
......@@ -27,11 +27,8 @@ RSpec.describe BulkImports::Common::Extractors::GraphqlExtractor do
allow(graphql_client).to receive(:execute).and_return(response)
end
it 'returns an enumerator with fetched results' do
response = subject.extract(context)
expect(response).to be_instance_of(Enumerator)
expect(response.first).to eq({ foo: :bar })
it 'returns original hash' do
expect(subject.extract(context)).to eq({ foo: :bar })
end
end
......
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