Sha256: 629eea876f9dd7e171e3df0551c514fff74ec9bc3ec273e8b8d9f9ed8495001a

Contents?: true

Size: 674 Bytes

Versions: 15

Compression:

Stored size: 674 Bytes

Contents

require 'spec_helper'

describe GraphQL::ID_TYPE do
  let(:result) { DummySchema.execute(query_string)}

  describe 'coercion for int inputs' do
    let(:query_string) { %|query getMilk { cow: milk(id: 1) { id } }| }

    it 'coerces IDs from ints and serializes as strings' do
      expected = {"data" => {"cow" => {"id" => "1"}}}
      assert_equal(expected, result)
    end
  end

  describe 'coercion for string inputs' do
    let(:query_string) { %|query getMilk { cow: milk(id: "1") { id } }| }

    it 'coerces IDs from strings and serializes as strings' do
      expected = {"data" => {"cow" => {"id" => "1"}}}
      assert_equal(expected, result)
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
graphql-0.11.1 spec/graphql/id_type_spec.rb
graphql-0.11.0 spec/graphql/id_type_spec.rb
graphql-0.10.9 spec/graphql/id_type_spec.rb
graphql-0.10.8 spec/graphql/id_type_spec.rb
graphql-0.10.7 spec/graphql/id_type_spec.rb
graphql-0.10.6 spec/graphql/id_type_spec.rb
graphql-0.10.5 spec/graphql/id_type_spec.rb
graphql-0.10.4 spec/graphql/id_type_spec.rb
graphql-0.10.3 spec/graphql/id_type_spec.rb
graphql-0.10.2 spec/graphql/id_type_spec.rb
graphql-0.10.1 spec/graphql/id_type_spec.rb
graphql-0.10.0 spec/graphql/id_type_spec.rb
graphql-0.9.5 spec/graphql/id_type_spec.rb
graphql-0.9.4 spec/graphql/id_type_spec.rb
graphql-0.9.3 spec/graphql/id_type_spec.rb