spec/graphql/upgrader/member_spec.rb in graphql-1.8.7 vs spec/graphql/upgrader/member_spec.rb in graphql-1.8.8

- old
+ new

@@ -290,30 +290,46 @@ it 'upgrades to the new definition' do old = %{field :name, !types.String} new = %{field :name, String, null: false} assert_equal new, upgrade(old) + old = %{field :name, types.String.to_non_null_type} + new = %{field :name, String, null: false} + assert_equal new, upgrade(old) + old = %{field :name, !types.String, "description", method: :name_full} new = %{field :name, String, "description", method: :name_full, null: false} assert_equal new, upgrade(old) old = %{field :name, -> { !types.String }} new = %{field :name, String, null: false} assert_equal new, upgrade(old) + old = %{field :name, -> { types.String.to_non_null_type }} + new = %{field :name, String, null: false} + assert_equal new, upgrade(old) + old = %{connection :name, Name.connection_type, "names"} new = %{field :name, Name.connection_type, "names", null: true, connection: true} assert_equal new, upgrade(old) old = %{connection :name, !Name.connection_type, "names"} new = %{field :name, Name.connection_type, "names", null: false, connection: true} assert_equal new, upgrade(old) + old = %{connection :name, Name.connection_type.to_non_null_type, "names"} + new = %{field :name, Name.connection_type, "names", null: false, connection: true} + assert_equal new, upgrade(old) + old = %{field :names, types[!types.String]} new = %{field :names, [String], null: true} assert_equal new, upgrade(old) + old = %{field :names, types[types.String.to_non_null_type]} + new = %{field :names, [String], null: true} + assert_equal new, upgrade(old) + old = %{field :names, !types[types.String]} new = %{field :names, [String, null: true], null: false} assert_equal new, upgrade(old) old = %{ @@ -340,19 +356,44 @@ field :name2, Integer, description: "def", null: false } assert_equal new, upgrade(old) old = %{ + field :name, types.String.to_non_null_type do + description "abc" + end + + field :name2, types.Int.to_non_null_type do + description "def" + end + } + new = %{ + field :name, String, description: "abc", null: false + + field :name2, Integer, description: "def", null: false + } + assert_equal new, upgrade(old) + + old = %{ field :name, -> { !types.String } do end } new = %{ field :name, String, null: false } assert_equal new, upgrade(old) old = %{ + field :name, -> { types.String.to_non_null_type } do + end + } + new = %{ + field :name, String, null: false + } + assert_equal new, upgrade(old) + + old = %{ field :name do type -> { String } end } new = %{ @@ -375,10 +416,26 @@ field :name2, String, null: false } assert_equal new, upgrade(old) old = %{ + field :name do + type String.to_non_null_type + end + + field :name2 do + type String.to_non_null_type + end + } + new = %{ + field :name, String, null: false + + field :name2, String, null: false + } + assert_equal new, upgrade(old) + + old = %{ field :name, -> { types.String }, "newline description" do end } new = %{ @@ -386,9 +443,19 @@ } assert_equal new, upgrade(old) old = %{ field :name, -> { !types.String }, + "newline description" do + end + } + new = %{ + field :name, String, "newline description", null: false + } + assert_equal new, upgrade(old) + + old = %{ + field :name, -> { types.String.to_non_null_type }, "newline description" do end } new = %{ field :name, String, "newline description", null: false