Sha256: fdf6eb0beadd46b9597b150781a48052ded3e67e39e2e90672e67da20150b8bc

Contents?: true

Size: 1.33 KB

Versions: 25

Compression:

Stored size: 1.33 KB

Contents

require "spec_helper"

describe GraphQL::Relay::ConnectionType do
  describe ".create_type" do
    describe "connections with custom Edge classes / EdgeTypes" do
      let(:query_string) {%|
        {
          rebels {
            basesWithCustomEdge {
              totalCountTimes100
              fieldName
              edges {
                upcasedName
                upcasedParentName
                edgeClassName
                node {
                  name
                }
                cursor
              }
            }
          }
        }
      |}

      it "uses the custom edge and custom connection" do
        result = star_wars_query(query_string)
        bases = result["data"]["rebels"]["basesWithCustomEdge"]
        assert_equal 300, bases["totalCountTimes100"]
        assert_equal 'basesWithCustomEdge', bases["fieldName"]
        assert_equal ["YAVIN", "ECHO BASE", "SECRET HIDEOUT"] , bases["edges"].map { |e| e["upcasedName"] }
        assert_equal ["Yavin", "Echo Base", "Secret Hideout"] , bases["edges"].map { |e| e["node"]["name"] }
        assert_equal ["CustomBaseEdge"] , bases["edges"].map { |e| e["edgeClassName"] }.uniq
        upcased_rebels_name = "ALLIANCE TO RESTORE THE REPUBLIC"
        assert_equal [upcased_rebels_name] , bases["edges"].map { |e| e["upcasedParentName"] }.uniq
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
graphql-1.2.6 spec/graphql/relay/connection_type_spec.rb
graphql-1.2.5 spec/graphql/relay/connection_type_spec.rb
graphql-1.2.4 spec/graphql/relay/connection_type_spec.rb
graphql-1.2.3 spec/graphql/relay/connection_type_spec.rb
graphql-1.2.2 spec/graphql/relay/connection_type_spec.rb
graphql-1.2.1 spec/graphql/relay/connection_type_spec.rb
graphql-1.2.0 spec/graphql/relay/connection_type_spec.rb
graphql-1.1.0 spec/graphql/relay/connection_type_spec.rb
graphql-1.0.0 spec/graphql/relay/connection_type_spec.rb
graphql-0.19.4 spec/graphql/relay/connection_type_spec.rb
graphql-0.19.3 spec/graphql/relay/connection_type_spec.rb
graphql-0.19.2 spec/graphql/relay/connection_type_spec.rb
graphql-0.19.1 spec/graphql/relay/connection_type_spec.rb
graphql-0.19.0 spec/graphql/relay/connection_type_spec.rb
graphql-0.18.15 spec/graphql/relay/connection_type_spec.rb
graphql-0.18.14 spec/graphql/relay/connection_type_spec.rb
graphql-0.18.13 spec/graphql/relay/connection_type_spec.rb
graphql-0.18.12 spec/graphql/relay/connection_type_spec.rb
graphql-0.18.11 spec/graphql/relay/connection_type_spec.rb
graphql-0.18.10 spec/graphql/relay/connection_type_spec.rb