Skip to content

Instantly share code, notes, and snippets.

@kadirpekel
Created October 12, 2010 09:59
Show Gist options
  • Save kadirpekel/621957 to your computer and use it in GitHub Desktop.
Save kadirpekel/621957 to your computer and use it in GitHub Desktop.
var meryl = require('meryl'),
async = require('async'),
httputil = require('nodeunit').utils.httputil;
exports.testSomething = function (test) {
httputil (
meryl.h('GET /', function(req, resp) {resp.send('test data');}).cgi(),
function (server, client) {
async.series([
function (ok) {
client.fetch('GET', '/', {'Host': 'localhost'}, function (resp) {
test.equal(resp.statusCode, 200);
test.equal(resp.body, 'test data');
ok();
});
},
function (ok) {
client.fetch('GET', '/absent', {'Host': 'localhost'}, function (resp) {
test.equal(resp.statusCode, 404);
ok();
});
},
function (ok) {
server.close();
test.done();
ok();
}
]);
}
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment