diff --git a/Readme.md b/Readme.md index 5beaa6b7..1a3460f2 100644 --- a/Readme.md +++ b/Readme.md @@ -81,9 +81,13 @@ describe('GET /users', function() { }); }); ``` + Also mind: + - if you are using the `.end()` method - it closes the server, even if you initially provided it running. + - the `this` keyword in the callback passed to `.end()` is the instance of `supertest.Test` class that manages the test. Expectations are run in the order of definition. This characteristic can be used to modify the response body or headers before executing an assertion. + ```js describe('GET /user', function() { @@ -210,6 +214,8 @@ describe('request.agent(app)', function(){ ### .end(fn) Perform the request and invoke `fn(err, res)`. + If the call was created with an instance of a server - it **closes** the server, wether it was bound to a port or not. + Also mind that the `this` context inside the callback is set to the `supertest.Test` instance, and not the mocha test or any other context you're running in. ## Notes