graphitation icon indicating copy to clipboard operation
graphitation copied to clipboard

RelayPayloadMockGenerator doesn't support nested lists

Open user1736 opened this issue 4 months ago • 0 comments

RelayPayloadMockGenerator doesn't produce a correct output for nested lists. This is a regression for graphql-js-operation-payload-generator package compared to v0.8.5.

How to reproduce

  1. Add a nested list type to the schema node_modules/relay-test-utils-internal/lib/testschema.graphql
type Query {
  ## Other root fields

  nestedList(id: ID!): [[Node!]!]!
}
  1. Generate new schema types for tests: yarn test:schema-types

  2. Add a test case:

test("generate mock for nested list", () => {
  testGeneratedData(graphql`
    query RelayMockPayloadGeneratorNestedListTestQuery {
      nestedList(id: "my-nested-list-id") {
        __typename
        id
      }
    }
  `);
});

Expected result: test passes.

Actual result: test fails with GraphQLError: Expected Iterable, but did not find one for field "Query.nestedList".

user1736 avatar Oct 09 '24 10:10 user1736