Skip to content

Instantly share code, notes, and snippets.

View snoopdave's full-sized avatar

David M. Johnson snoopdave

View GitHub Profile
@snoopdave
snoopdave / gist:b612da40251ce9149bd3bb2b9eae0150
Last active April 19, 2023 22:56
Prompt to create GraphQL Relay-Connections testing example

I want to create a Typescript project that is a example of how to test a GraphQL server and verify that the server supports the Relay-Connections specification here: https://relay.dev/graphql/connections.htm

The project should meet these requirements:

  • Contains a Jest test file as follows:
    • Before running test, Apollo Server before running the tests:
      • The server should be started as shown here: https://github.com/snoopdave/blogql/blob/main/server/src/integration.test.ts#L48
      • The server should provide:
        • A GraphQL schema that defines a User type with id, name, email address properties. The GraphQL schema should be read from a separate file called schema.graphql
        • A GraphQL query called getUsers that returns a collection of users with Relay-Connection paging, by default this query returns a maximum of 10 users at a time. Both forward and backward paging should be supported
  • When the server starts, it should create a collection of 100 random users in-memory using Faker and these use