Sha256: ba07155e240dfb186f86727725d4eb53f8c97e7ca3b0798631b7134a02f0dcc6

Contents?: true

Size: 1.21 KB

Versions: 3

Compression:

Stored size: 1.21 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
              edges {
                upcasedName
                upcasedParentName
                edgeClassName
                node {
                  name
                }
              }
            }
          }
        }
      |}

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

      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
graphql-relay-0.12.0 spec/graphql/relay/connection_type_spec.rb
graphql-relay-0.11.2 spec/graphql/relay/connection_type_spec.rb
graphql-relay-0.11.1 spec/graphql/relay/connection_type_spec.rb