Sha256: 1276233f6b85c863ce531e1eed30691aeefe05da461d03be66f451e0cf36eb0e

Contents?: true

Size: 736 Bytes

Versions: 7

Compression:

Stored size: 736 Bytes

Contents

# frozen_string_literal: true
require "spec_helper"

describe GraphQL::Schema::Union do
  let(:union) { Jazz::PerformingAct }
  describe "type info" do
    it "has some" do
      assert_equal 2, union.possible_types.size
    end
  end

  describe "in queries" do
    it "works" do
      query_str = <<-GRAPHQL
      {
        nowPlaying {
          ... on Musician {
            name
            instrument {
              family
            }
          }
          ... on Ensemble {
            name
          }
        }
      }
      GRAPHQL

      res = Jazz::Schema.execute(query_str)
      expected_data = { "name" => "Bela Fleck and the Flecktones" }
      assert_equal expected_data, res["data"]["nowPlaying"]
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
graphql-1.8.0.pre7 spec/graphql/schema/union_spec.rb
graphql-1.8.0.pre6 spec/graphql/schema/union_spec.rb
graphql-1.8.0.pre5 spec/graphql/schema/union_spec.rb
graphql-1.8.0.pre4 spec/graphql/schema/union_spec.rb
graphql-1.8.0.pre3 spec/graphql/schema/union_spec.rb
graphql-1.8.0.pre2 spec/graphql/schema/union_spec.rb
graphql-1.8.0.pre1 spec/graphql/schema/union_spec.rb