January 2018
Beginner
658 pages
13h 10m
English
A lot of the built-in assertions do get the job done for the majority of cases. There are times where you want a little more flexibility. For example, in the previous chapter, we learned about all those cool assertions expect can make. We can use toInclude, toExclude, all of that stuff is really handy and it's a shame to lose it. Luckily, there's a lot of flexibility with SuperTest. What we can do instead of taking an object and passing it into expect, or a number for the status code, we can provide a function. This function will get called by SuperTest and it will get passed the response:
.expect((res) => { })
This means we can access headers, body, anything we want to access from the HTTP response—it's going ...
Read now
Unlock full access