문제

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