Skip to content

Commit

Permalink
chore: Add test for interpreter RawValue in list
Browse files Browse the repository at this point in the history
  • Loading branch information
bbugh committed Apr 5, 2021
1 parent 030ffa4 commit 6894cba
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions spec/graphql/execution/interpreter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 6894cba

Please sign in to comment.