-
-
Notifications
You must be signed in to change notification settings - Fork 2
Updated fragment tests #75
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
…s with complexity 0
|
@evanmcneely Do you think the complexity analysis algo should throw an error for unhandled node cases during development? This could help us catch cases we haven't considered. I'm thinking of the case where the test 'with fragments...that have a complexity of zero' is passing before fragments have been implemented? |
haha, while in development it's probably not a big deal but if there's anything we don't get done before "launch" then ya we probably should. It wouldn't be hard because you could throw on error in the This might also be a good way to lay out the rest of the node functions and flow of the calls before implementing the logic. |
evanmcneely
left a comment
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.
This is good. I reviewed the non-null tests in the other PR #64
Will add these errors along with the implementation of #44 |
… condition, directives and multiple applicable fragments. created separate typeWeight object for union tests on fragments for clarity
… condition, directives and multiple applicable fragments. created separate typeWeight object for union tests on fragments for clarity
…te into sh/fragment-tests
| } | ||
| }`; | ||
| // Query 1 + 1 hero + max(Droid 0, Human 3) = 5 | ||
| mockHumanFriendsFunction.mockReturnValueOnce(3); |
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 friends field on human invokes the mockChracterFriendsFunction not the mockHumanFriendFunction
| hero(episode: EMPIRE) { | ||
| ... { | ||
| name | ||
| scalarList(first: 1) |
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.
Where is scalar list coming from?
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 tests for inline fragments on interfaces use the type weight object defined at the top of the file which contains a scalarList field on the Character interface. Let me know if you think it's more clear to create a dedicated type weight object for these tests similar to the tests for inline fragments on unions.
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.
OK I see, I don't think you need to create a new type weight object, that's just more work to maintain. It's just hard to follow the nested describes in a file this big using githubs GUI.
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.
Amen, It could probably benefit from modularity and splitting into multiple files with a shared initialize() method that builds the typeWeight object
evanmcneely
left a comment
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.
Good work. Lot's of edge cases I didn't know about. Approve with some things to check.
In implementation, I think you'll run into some problems when looking in the typeWeightsObject for a union and not seeing what it is a union of in order to find the fields you need to get weights of. I wouldn't be surprised if you have to refactor the typeWeightsObject to have that information. We'll only find out when actually doing the work.
Agreed, see my comments on #44. Current idea is just to look for common fields when we parse the schema and add these to both the Union type |
Summary
This updates the test suite for queries using fragments. These tests test for the following:
The test also cleans up function mocks in the complexity suite to avoid mocking incorrect return values when tests are run in parallel.
Type of Change
Issues
Evidence