cosmo icon indicating copy to clipboard operation
cosmo copied to clipboard

test: introduce tests for @requires

Open clayne11 opened this issue 1 year ago • 6 comments

Motivation and Context

The Cosmo router ostensibly supports the @requires directive, however it doesn't seem to work properly. Added tests to router-tests to show the expected behavior.

These tests currently fail since the router logic seems to be incorrect. This is both true for @requires directives with flat fields as well as ones with nested selection sets, although each of these lead to different error patterns.

clayne11 avatar Apr 07 '24 19:04 clayne11

Hi @clayne11

Would you mind rebasing? If things are still failing, we'll investigate.

Thank you for the contribution!

Aenimus avatar Apr 11 '24 14:04 Aenimus

Rebased — tests are still failing.

--- FAIL: TestTestdataQueries (5.67s)
    --- FAIL: TestTestdataQueries/requires (0.31s)
        integration_test.go:469: Result did not match the golden fixture. Diff is below:

            --- Expected
            +++ Actual
            @@ -1,16 +1,11 @@
             {
            -  "data": {
            -    "products": [
            -      {
            -        "lead": {
            -          "id": 1,
            -          "derivedID": 1
            -        },
            -        "isLeadAvailable": false
            -      },
            -      {},
            -      {}
            -    ]
            -  }
            +  "errors": [
            +    {
            +      "message": "Cannot return null for non-nullable field 'Query.products'.",
            +      "path": [
            +        "products"
            +      ]
            +    }
            +  ],
            +  "data": null
             }
            -

clayne11 avatar Apr 12 '24 18:04 clayne11

This PR was marked stale due to lack of activity. It will be closed in 14 days.

github-actions[bot] avatar Apr 27 '24 05:04 github-actions[bot]

This is not stale, please don't close it.

clayne11 avatar Apr 30 '24 17:04 clayne11

@clayne11 Hi Curtis,

Apologies for my lack of updates. We know what the issue is, and we're working on some fixes.

We're still interested in the PR and don't plan to close this.

Thanks for your patience!

Aenimus avatar Apr 30 '24 18:04 Aenimus

Hi @clayne11 we have merged a fix for an issue preventing from running tests

I split requires tests into 2 separate tests and fixed requires resolvers One of the tests is still not working, we could plan it, but at the moment the resolver is missing information about how to execute fetches in the proper order

devsergiy avatar May 28 '24 14:05 devsergiy