October 30, 2020 How would I go about unittesting a vibe.d app? | ||||
---|---|---|---|---|
| ||||
For example, I am trying to test a route. Within the unittest I setup the server locally (note: is it possible to start the server once for all unit tests?), then call listenHTTP. After the listen call I make a client request to localhost with requestHTTP and I get the following error: WARNING: HTTPClientResponse not fully processed before being finalized The code for reference: unittest { // imports... auto listener = setupServer(); // makes the listenHTTP call scope(exit) listener.stopListening(); requestHTTP( environment["HOST"] ~ "/register", (scope req) { req.method = HTTPMethod.POST; req.writeFormBody(["foo": "bar"]); }, (scope res) { assert (res.statusCode == 200); }, ); } Note: I am running tests using dub if that is relevant. |
Copyright © 1999-2021 by the D Language Foundation