Closed davidjamesb closed 2 years ago
Thanks for the details, I’ll take a look at the info provided this week!
The PR for the proposed fix is most appreciated!
Ok, Merged, pulled, and re-ran tests . . . new test coverage is passing as expected (was definitely failing before).
This now resolves issue #8 👍!
I'll push a minor update to Nuget soon!
When no results are returned by an underlying data source (e.g. empty list/table, etc) IEnumerableCursorPagingCustomExtensions.SliceAsCursorPage() creates a new CursorPageSlice and passes null for the results parameter. This causes an ArgumentException to be thrown by the CursorPageSlice constructor.
This bug was discovered when testing a resolver over a postgresql table I had just created but contained no rows. The GraphQL query should return an empty node collection and totalCount = 0.
Relevant line for the bug:
https://github.com/cajuncoding/GraphQL.RepoDB/blob/52dabefdeec5f6d29e4f97c3a927bc05426ac31c/GraphQL.PreProcessingExtensions/Paging/CursorPaging/IEnumerableCursorPagingCustomExtensions.cs#L45
This can be reproduced by modifying Tests.StarWarsCharacterResolver.CreateCharacters to return an empty list and running the TestParamsContextCursorPagingOnlyFirst test.
This PR modifies behavior this by: