Created
August 22, 2012 01:23
-
-
Save DougReeder/3421161 to your computer and use it in GitHub Desktop.
Node.js server tests using Vows
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var vows = require('./vows/lib/vows'), | |
| assert = require('assert'), | |
| http = require("http"); | |
| require("../server.js"); // starts the server | |
| exports.suite1 = vows.describe('server-test').addBatch({ | |
| "the root URL": { | |
| topic: function () { | |
| var options = { | |
| host: "localhost", | |
| port: 1234, | |
| path: "/" | |
| }; | |
| var callback = this.callback; | |
| http.get(options, function (response) { | |
| callback(null, response); | |
| }).on('error', function (error) { | |
| console.log("Got error: " + error.message); | |
| callback(error); | |
| }); | |
| }, | |
| "returns status OK": function (response) { | |
| assert.equal(response.statusCode, 200); | |
| assert.equal(response.httpVersion, "1.1"); | |
| }, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment