-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Cleaning up tests with deprecated usage: Part 2 #2941
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a dedicated deprecated test for this already
|
|
||
| then: | ||
| values['arg'] == 'hello' | ||
| values['arg'] == [inputField: 'hello'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These deprecated methods are tested elsewhere
Fixing up tests involving coercing, applied directives, applied directive arguments