Вопрос

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?

Это было полезно?

Решение

  "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);
    }));
  }   
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top