Hey, thanks again for your work! I really appreciate it as a beginner in the TDD community.
I'm currently going through the guide and if I find a typo I will let you know :)
https://outsidein.dev/outside-in-tdd.html#beyond-traditional-tdd ( Finally, building from the middle out can result in can result in building functionality that is unused or difficult to use. )
@KristianWEB7_twitter that's a good question! I haven't worked extensively with GraphQL so I wouldn't be the best one to write extensively on it. As you work with it, I'd encourage you to blog about TDD approaches that you discover!
I think the key principle that applies is to isolate your application code from the third-party code, in this case the GraphQL library. An example is how the book's component tests don't know about Redux. You can do the same thing with a GraphQL library by creating a "dumb" component that receives plain props that you test, and a parent "connected" component that connects to your GraphQL library. This kind of works against how React hooks work by default, but it's common to need to separate concerns for testability like that.
As for testing your GraphQL code, for simple queries, I might not unit test them at all: that's just configuration. Your E2E Test will cover that. When you have logic (like, updating a local cache after you save a record to the server), there are two approaches you can investigate: (1) testing your code in isolation from the library, which might mean extracting a stand-alone function you can test directly, or (2) testing your code in integration from the GraphQL library, which would involve finding the simplest way you can configure and send commands to the library from within a test.
Those principles should help you have direction no matter what kind of code you're looking to test in the future.
Hi! Thanks a lot for your guide.
I just want to add that don't need to install eslint in this step https://outsidein.dev/react/2-project-setup.html#setting-up-autoformatting
Right now it makes some troubles with eslint versions (v 6.6 vs v. 7)
The react-scripts package provided by Create React App requires a dependency:
"eslint": "^6.6.0"
fs.existsSync is not a function