Advanced GraphQL, v2 Errors & Testing Exercise
Transcript from the "Errors & Testing Exercise" Lesson
>> Use Apollo error classes to handle errors. So every where where we're throwing errors, like this authentication helpers and authorization helpers you created earlier on. Or anywhere else you're throwing errors, use the built in Apollo error classes instead. So slap those out, and then I need you to create some integration tests for your queries and mutations.
[00:00:16] Just try to create one for a query. Try to create one more for mutation and that should be fine. Don't have to worry about all of them. I mean, you fill in like you really want to write some tests. Go ahead and test them all out. But one for query and one for mutation just so you can get a feel of it should be good.
[00:00:31] And then I would say also just, I know resolvers seem pretty trivial, but also create a test for your resolver. So I don't have an example of that because it's pretty much the exact same thing as this. You will just need a test block or test just doesn't matter which one you use, and then you might do something like instead of snapshotting.
[00:00:50] You might do something results from a resolver to equal something else and that's kinda how Matchers work in this, just so pretty simple. You just you don't need snapshots for that. So just just pick a resolver that you want maybe two or three, they should be pretty simple to get those going.