From 6894cba28e7e452d43ba577a343a5b1e83e593d1 Mon Sep 17 00:00:00 2001 From: Brian Bugh Date: Mon, 5 Apr 2021 10:12:13 -0500 Subject: [PATCH] chore: Add test for interpreter RawValue in list --- spec/graphql/execution/interpreter_spec.rb | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/spec/graphql/execution/interpreter_spec.rb b/spec/graphql/execution/interpreter_spec.rb index b376187d12..f7a3a36cc3 100644 --- a/spec/graphql/execution/interpreter_spec.rb +++ b/spec/graphql/execution/interpreter_spec.rb @@ -171,6 +171,12 @@ def expansion_raw raw_value(sym: "RAW", name: "Raw expansion", always_cached_value: 42) end + field :expansion_mixed, [Expansion], null: false + + def expansion_mixed + expansions + [expansion_raw] + end + field :expansions, [Expansion], null: false def expansions EXPANSIONS @@ -523,4 +529,21 @@ def self.resolve_type(type, obj, ctx) assert_equal({ sym: "RAW", name: "Raw expansion", always_cached_value: 42 }, res["data"]["expansionRaw"]) end end + + describe "returning raw values and resolved fields" do + it "returns raw value" do + query_str = <<-GRAPHQL + { + expansionRaw { + name + sym + alwaysCachedValue + } + } + GRAPHQL + + res = InterpreterTest::Schema.execute(query_str) + assert_equal({ sym: "RAW", name: "Raw expansion", always_cached_value: 42 }, res["data"]["expansionRaw"]) + end + end end