Sha256: 6c3b2a0907b54643e947a2175e1583734dd8cd8d60d69302d29b262c06c07d80

Contents?: true

Size: 870 Bytes

Versions: 10

Compression:

Stored size: 870 Bytes

Contents

# frozen_string_literal: true
require "spec_helper"

describe GraphQL::Schema::Scalar do
  describe "in queries" do
    it "becomes output" do
      query_str = <<-GRAPHQL
      {
        find(id: "Musician/Herbie Hancock") {
          ... on Musician {
            name
            favoriteKey
          }
        }
      }
      GRAPHQL

      res = Jazz::Schema.execute(query_str)
      assert_equal "B♭", res["data"]["find"]["favoriteKey"]
    end

    it "can be input" do
      query_str = <<-GRAPHQL
      {
        inspectKey(key: "F♯") {
          root
          isSharp
          isFlat
        }
      }
      GRAPHQL

      res = Jazz::Schema.execute(query_str)
      key_info = res["data"]["inspectKey"]
      assert_equal "F", key_info["root"]
      assert_equal true, key_info["isSharp"]
      assert_equal false, key_info["isFlat"]
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
graphql-1.8.0.pre10 spec/graphql/schema/scalar_spec.rb
graphql-1.8.0.pre9 spec/graphql/schema/scalar_spec.rb
graphql-1.8.0.pre8 spec/graphql/schema/scalar_spec.rb
graphql-1.8.0.pre7 spec/graphql/schema/scalar_spec.rb
graphql-1.8.0.pre6 spec/graphql/schema/scalar_spec.rb
graphql-1.8.0.pre5 spec/graphql/schema/scalar_spec.rb
graphql-1.8.0.pre4 spec/graphql/schema/scalar_spec.rb
graphql-1.8.0.pre3 spec/graphql/schema/scalar_spec.rb
graphql-1.8.0.pre2 spec/graphql/schema/scalar_spec.rb
graphql-1.8.0.pre1 spec/graphql/schema/scalar_spec.rb