createRequest | method | (requestBase) => Request | This function is used to create the request passed to the API as if it was the express request. Its sole parameter is a very minimal version of the request, which you may use as a template. This method can be used to add any necessary fields to the request. const createRequest = base => ({...base, headers: { 'content-type': 'text/html' }})
| No |
createResponse | method | (responseBase) => Response | This function is used to create the response passed to the API as if it was the express response. Its sole parameter a wrapper papupata uses to handle the response, which can be extended with other properties and methods as necessary. const createResponse = base => ({...base, myField: true})
| No |
assertResponse | method | (response) => void | This function is called once the response is complete. It is passed a mock express response, allowing for making assertions to whatever it may contain. const assertResponse = res => expect(res.statusCode).toEqual(400)
| No |
withMiddleware | property | boolean | By default, and if explicitly set to false only the API implementation is called and all middleware is ignored. If set to true, any express and papupata middleware on the route is run as normal for the requests. | No |