cosmo
cosmo copied to clipboard
test: introduce tests for @requires
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.
Hi @clayne11
Would you mind rebasing? If things are still failing, we'll investigate.
Thank you for the contribution!
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
}
-
This PR was marked stale due to lack of activity. It will be closed in 14 days.
This is not stale, please don't close it.
@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!
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