Testing with

Apollo Client

crisu83

Christoffer Niska

Technology Evangelist

Compile

What is

Apollo Client?

crisu83

A complete state management library for JavaScript apps that uses GraphQL to fetch data from the server.

The problem

crisu83

The solution(s)

crisu83

MockedProvider

crisu83

A test-utility that allows you to create

a mocked version of the ApolloProvider.

 

SchemaProvider

crisu83

A test-utility that uses SchemaLink to provide a GraphQL execution environment for the provided schema.

What about errors?

crisu83

ErrorProvider

crisu83

A test-utility that uses a custom ApolloLink to add errors to GraphQL requests that are made by the client.

What about loading?

crisu83

LoadingProvider

crisu83

A test-utility that uses a custom ApolloLink that delays all GraphQL requests indefinitely.

Demo

crisu83

github.com/crisu83/testing-with-apollo

Questions?

crisu83

Thank you!

crisu83

Testing with Apollo

By Christoffer Niska

Testing with Apollo

It's not easy to write unit tests for components that rely on GraphQL queries, mutations, (and subscriptions) handled by Apollo Client. In my talk, I will share some tips and tricks that make writing those tests a little bit easier.

  • 414