module GraphQL::Compatibility::ExecutionSpecification

def test_it_propagates_nulls_to_field

def test_it_propagates_nulls_to_field
  query_string = %|
  query getOrg($id: ID = "2001"){
    failure: node(id: $id) {
      ... on Organization {
        name
        leader { name }
      }
    }
    success: node(id: $id) {
      ... on Organization {
        name
      }
    }
  }
  |
  res = execute_query(query_string)
  failure = res["data"]["failure"]
  success = res["data"]["success"]
  assert_equal nil, failure, "It propagates nulls to the next nullable field"
  assert_equal({"name" => "SNCC"}, success, "It serves the same object if no invalid null is encountered")
  assert_equal 1, res["errors"].length , "It returns an error for the invalid null"
end