Question

I am maintain a search server written in node.js www.foragejs.net and I am trying to put together a test suite, that checks that responses are correctly formatted.

How would I do this using buster.js?

Was it helpful?

Solution

  "test asynchronous": function (done) {
    var options = {
      host: 'localhost',
      port: 3000,
      path: '/search?q=moscow'
    };
    http.get(options, done(function(res) {
      console.log("Got response: " + res.statusCode);
      assert.equals(res.statusCode, 200);
    })).on('error', done(function(e) {
      console.log("Got error: " + e.message);
      assert(false);
    }));
  }   
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top