Test-Driving GraphQL
GraphQL offers an alternative to HTTP requests for fetching data. It offers a whole bunch of additional features that can be added to data requests.
As with Redux, GraphQL systems can seem complicated, but TDD helps to provide an approach to understanding and learning.
In this chapter, we’ll use the Relay library to connect to our backend. We’re going to build a new CustomerHistory
component that displays details of a single customer and their appointment history.
This is a bare-bones GraphQL implementation that shows the fundamentals of test-driving the technology. If you’re using other GraphQL libraries instead of Relay, the techniques we’ll explore in this chapter will also apply.
Here’s what the new CustomerHistory
component looks like:
Figure 13.1 – The new CustomerHistory component
This chapter covers the following topics:
- Compiling the schema before you begin
- Test...