Sha256: a2ee0fa6d8db265a66f58df4dd51dcf7e69732f138cb7371a57f8cd07da54d37
Contents?: true
Size: 1.3 KB
Versions: 2
Compression:
Stored size: 1.3 KB
Contents
require 'spec_helper' describe GraphQL::Relay::Mutation do let(:query_string) {%| mutation addBagel($clientMutationId: String) { introduceShip(input: {shipName: "Bagel", factionId: "1", clientMutationId: $clientMutationId}) { clientMutationId shipEdge { node { name, id } } faction { name } } } |} let(:introspect) {%| { __schema { types { name, fields { name } } } } |} after do STAR_WARS_DATA["Ship"].delete("9") STAR_WARS_DATA["Faction"]["1"]["ships"].delete("9") end it "returns the result & clientMutationId" do result = star_wars_query(query_string, "clientMutationId" => "1234") expected = {"data" => { "introduceShip" => { "clientMutationId" => "1234", "shipEdge" => { "node" => { "name" => "Bagel", "id" => NodeIdentification.to_global_id("Ship", "9"), }, }, "faction" => {"name" => STAR_WARS_DATA["Faction"]["1"].name } } }} assert_equal(expected, result) end it "doesn't require a clientMutationId to perform mutations" do result = star_wars_query(query_string) new_ship_name = result["data"]["introduceShip"]["shipEdge"]["node"]["name"] assert_equal("Bagel", new_ship_name) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
graphql-0.18.6 | spec/graphql/relay/mutation_spec.rb |
graphql-0.18.5 | spec/graphql/relay/mutation_spec.rb |