topic
부모 값을 자식 topic
값으로 전달하는 데 문제가 있습니다. 코드는 비동기식이며 문제가있는 곳이라고 생각합니다. JSON 응답의 일부가 테스트의 주제가되기를 바란다. 다음은 테스트의 관련 부분입니다.비동기 주제 범위 Vows.JS
{
"A test":{
topic: function() {
request(conf.server + '/categories/' + id, this.callback)
},
'should respond with a 200': function(err, res, body) {
res.statusCode.should.equal(200);
console.log(JSON.parse(body).title);
},
'should have valid JSON in the body': function(err, res, body) {
(function() {
JSON.parse(body);
}).should.not.
throw();
},
'category collection': {
topic: function(err, res, body) {
console.log(res.statusCode);
return JSON.parse(body).categories
},
'should have a length greater than 0': function(topic) {
topic.length.should.be.above(0);
}
}
}
}
console.log(res.statusCode)
은 정의되지 않은 수율 [SyntaxError: Unexpected token u]
"0보다 길이가 더 있어야한다"의 topic
를 로그인을 시도 얻을 수 있습니다.
이 작업을 수행 할 수 있습니까? 그렇다면 어떻게?