Sha256: 4c5b68c661c17e60c12557e6fdebc7c8a21b594f3b8abce2bab1201daa11aa93

Contents?: true

Size: 942 Bytes

Versions: 8

Compression:

Stored size: 942 Bytes

Contents

require 'spec_helper'

describe GraphQL::Relay::Mutation do
  let(:query_string) {%|
    mutation addBagel {
      introduceShip(input: {shipName: "Bagel", factionId: "1", clientMutationId: "1234"}) {
        clientMutationId
        ship { name, id }
        faction { name }
      }
    }
  |}
  let(:introspect) {%|
    {
      __schema {
        types { name, fields { name } }
      }
    }
  |}

  it "returns the result & clientMutationId" do
    result = query(query_string)
    expected = {"data" => {
      "introduceShip" => {
        "clientMutationId" => "1234",
        "ship" => {
          "name" => "Bagel",
          "id" => GraphQL::Relay::Node.to_global_id("Ship", "9"),
        },
        "faction" => {"name" => STAR_WARS_DATA["Faction"]["1"].name }
      }
    }}
    assert_equal(expected, result)
    # Cleanup:
    STAR_WARS_DATA["Ship"].delete("9")
    STAR_WARS_DATA["Faction"]["1"]["ships"].delete("9")
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
graphql-relay-0.3.6 spec/graphql/relay/mutation_spec.rb
graphql-relay-0.3.5 spec/graphql/relay/mutation_spec.rb
graphql-relay-0.3.4 spec/graphql/relay/mutation_spec.rb
graphql-relay-0.3.3 spec/graphql/relay/mutation_spec.rb
graphql-relay-0.3.2 spec/graphql/relay/mutation_spec.rb
graphql-relay-0.3.1 spec/graphql/relay/mutation_spec.rb
graphql-relay-0.3.0 spec/graphql/relay/mutation_spec.rb
graphql-relay-0.2.0 spec/graphql/relay/mutation_spec.rb