DEV Community

Creating fake backend with GraphQL

Tomek Poniatowicz on February 15, 2019

What is mocking? Mocking is primarily used in unit testing and it’s a practice of creating a fake version of an object or a component, s...
Collapse
 
danroc profile image
Daniel da Rocha

Hey Tomek, thanks for the tip!
But one thing I do not understand: shouldn't the mock backend preferably be local? How is your solution different than connecting to a real backend for tests (assuming there is one), in terms of speed?

Collapse
 
tomekponiat profile image
Tomek Poniatowicz

Hey Daniel!
Well, I think that question answers itself, there must be a real backend ready.
In many projects (this is very unfortunate but still happens quite often) backend and frontend teams work simultaneously and from my experience in a majority of cases, projects come to a point where backend is lacking some implementation and that causes delays on the frontend.

Collapse
 
danroc profile image
Daniel da Rocha

oh, I think I misunderstood. I was assuming this was a mock backend for testing purposes, as in using a mock api endpoint for testing components and functions with Jest, for example.

Collapse
 
andreslopezrm profile image
Andres Lopez

Excellent contribution, thanks is very useful πŸ˜„