Cleaning up tests with deprecated usage: Part 2#2941
Conversation
|
|
||
| /** | ||
| * The Coercing interface is used by {@link graphql.schema.GraphQLScalarType}s to parse and serialise object values. | ||
| * The Coercing interface is used by {@link graphql.schema.GraphQLScalarType}s to parse and serialize object values. |
There was a problem hiding this comment.
Keeping it consistent, as much as it pains me to use z here
| @@ -1,84 +0,0 @@ | |||
| package graphql | |||
There was a problem hiding this comment.
It's hard to find tests with file names like "Issue 296". Moving tests in generic file names to a better home.
In this case, the test file for Introspection.
| GraphQLObjectType getType(TypeResolutionEnvironment env) { | ||
| assert env.getField().getName() == "foo" | ||
| assert env.getFieldType() == env.getSchema().getType("BarInterface") | ||
| assert env.getContext() == "Context" |
There was a problem hiding this comment.
There is a dedicated deprecated test for this already
|
|
||
| then: | ||
| values['arg'] == 'hello' | ||
| values['arg'] == [inputField: 'hello'] |
There was a problem hiding this comment.
Note this is a deliberate change - a string result changed to a map.
This is why defaultValue is deprecated, it didn't pick up that the default value type was wrong! 😁
| then: | ||
| queryTypeFields == [[name: "inA"], [name: "inB"], [name: "inC"]] | ||
| } | ||
|
|
There was a problem hiding this comment.
Copied from "Issue 296" test file. Giving it a better home here in this IntrospectionTest file
| @@ -1,16 +1,16 @@ | |||
| package graphql | |||
There was a problem hiding this comment.
Moving tests out of generically named files like "Issue 2001" and into a better home.
In this case, an Applied Directive Argument file
|
|
||
| def "test non-list value for a list argument of a directive"() { | ||
| class GraphQLAppliedDirectiveArgumentTest extends Specification { | ||
| def "test non-list value for a list argument of a directive - issue 2001"() { |
There was a problem hiding this comment.
I've kept the "issue 2001" in the test name in case someone wants to refer back to it
| .type(GraphQLString) | ||
| .withDirective(newDirective().name("directive3")) | ||
| .value("VALUE") | ||
| .value("VALUE") // Retain deprecated for test coverage |
There was a problem hiding this comment.
Deprecated GraphQLArgument methods live in this test file
| schema.getSchemaDirective("d1").name == "d1" | ||
| schema.getSchemaDirectiveByName().keySet() == ["d1"] as Set | ||
| schema.getSchemaAppliedDirective("d1").name == "d1" | ||
| schema.getAllSchemaAppliedDirectivesByName().keySet() == ["d1", "dr"] as Set |
There was a problem hiding this comment.
The behaviour slightly changed - the previous method only included non-repeatable directives. The new one includes non-repeatable and repeatable, hence the assert change
| def fooDirective = field.getDirective("foo") | ||
| fooDirective.arguments.collect { it.name }.sort() == ["arg1", "arg2"] | ||
| fooDirective.arguments.collect { GraphQLArgument.getArgumentValue(it) }.sort() == ["arg2Value", "fooArg1Value",] | ||
|
|
There was a problem hiding this comment.
These deprecated methods are tested elsewhere
Fixing up tests involving coercing, applied directives, applied directive arguments