Integration-Test-Framework to simply request a server
npm install warp-node
Warp = require "warp-node"describe "topic"->beforeEach ->warp = Warpcreatewarp.request.url = "GET "warp.request.repeat = 1warp.request.delay = 200warp.request.headers = "x-forwarded-for": "127.0.0.1"# Doing some asynchronous things, like starting a server and than call `warp.activate()`.warpactivateit "should respond without errors"->warpexecute expecterrtoBeUndefinedit "should respond with status code 200"->warpexecute expectresstatusCodetoEqual200it "should respond with 'pong'"->warpexecute expectdatatoEqual"pong"
Creating a new
warp instance. Options is optionally an object with the following properties.
url: "GET " # Defining url for GET or POST requests including port and pathdata: "foo" # Data to be send using POST requestsencoding: "UTF8" # Encoding of given dataresEncoding: "UTF8" # Encoding of receiving responserepeat: 5 # Number of times the request have to be repeateddelay: 200 # Number of milliseconds the request call have to be delayed
Activating the warp to get ready to test. This is usefull to starting a server what is mostly asynchonous.
Getter/Setter, defining url for GET or POST requests including port and path.
Getter/Setter, data to be send using POST requests.
Getter/Setter, encoding of given data.
Getter/Setter, encoding of receiving response.
Getter/Setter, number of times the request have to be repeated.
defaults to 1. If it is set to something higher the response data format
changes from single values to lists of values for each call. See
Getter/Setter, number of milliseconds the request call have to be delayed.
Executing the test. Given callback provides the following information as single
warp.request.repeat is set to something higher than 1, the provided
information are lists containing the data for each repeated request.
err, error object if something went wrong, else
res, http response object
data, string containing received payload