Skip to content

Conversation

@kidunot89
Copy link
Collaborator

@kidunot89 kidunot89 commented May 2, 2024

What does this implement/fix? Explain your changes.

  • Upgrades WPGraphQL Testcase to v3.
  • Updates tests using assertIsResponseValid assertion to use the new assertResponseIsValid assertion.
  • Fixes issues in preexisting wpunit tests surfaced by the new versions.

Does this close any currently open issues?

Any relevant logs, error output, GraphiQL screenshots, etc?

Any other comments?

Where has this been tested?

Operating System:

WordPress Version:

@kidunot89 kidunot89 requested review from jasonbahl and justlevine May 2, 2024 04:42
@justlevine justlevine changed the title devops: WPGraphQLTestcase upgraded to v3 chore: WPGraphQLTestcase upgraded to v3 May 2, 2024
@coveralls
Copy link

coveralls commented May 2, 2024

Coverage Status

coverage: 84.323% (+0.03%) from 84.289%
when pulling 46884ae on kidunot89:devops/wp-graphql-testcase-v3
into a66f3e1 on wp-graphql:develop.

Copy link
Collaborator

@jasonbahl jasonbahl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a couple comments / questions

public function testDeRegisterConnectionWithUnderscores() {

deregister_graphql_connection( 'test_field_with_underscores' );
deregister_graphql_connection( 'TestConnectionFieldWithUnderscores' );
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change defeats the purpose of the test 🤔

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intent of the test as I understood is that deregister_graphql_connection() also removes the connecting field even if the field is in underscores.deregister_graphql_field() is tested separately for underscores.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe it is a type with underscores, and the connectionTypeName needs to be changed to include underscores?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@justlevine I bet the intent was for the Type Name to have underscores. Because it is valid to have a Type like My_Custom_Type and I believe the intent of the test was to ensure that any normalization on the strings under the hood isn't stripping underscores, etc 🤷🏻‍♂️

Like I know the registry normalizes types to lowercase strings in some places, so this should be ensuring that a connection registered with underscores is also removed when deregistered

'fromFieldName' => 'failingAuthConnection',
'resolve' => static function () {
return [ 'nodes' => [ null, false, 0 ] ];
return [ 'nodes' => [ '', false, 0 ] ];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did this change? Is there a regression somewhere we need to document?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you return a null for an object's root you GraphQL does not resolve that types fields. Which was making this test fail.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specifically, the Connection Interfaces release made nodes non nullable. The error was just getting suppressed before.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

@kidunot89 kidunot89 May 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I think I figured out the way the test was suppose to be in the first place and fixed it, and added some inline comments so this never happens again.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specifically, the Connection Interfaces release made nodes non nullable. The error was just getting suppressed before.

That first node was never supposed to be a falsy value in the first place. I change it to test.

@kidunot89 kidunot89 requested review from jasonbahl and justlevine May 2, 2024 20:24
@qlty-cloud-legacy
Copy link

Code Climate has analyzed commit 46884ae and detected 0 issues on this pull request.

View more on Code Climate.

@jasonbahl jasonbahl merged commit 89ee7cf into wp-graphql:develop May 2, 2024
@jasonbahl jasonbahl mentioned this pull request May 2, 2024
@kidunot89 kidunot89 deleted the devops/wp-graphql-testcase-v3 branch May 2, 2024 23:19
jasonbahl added a commit that referenced this pull request May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants