0
로그인 할 때 게시 할 기능이있는 앱을 만들고 있습니다. mocha에 다음 테스트 코드를 작성했습니다.) 나는 (내가 다 사용하여 몇 가지 실수를 생각done()은 슈퍼 에이전트 요청 내에서 작동하지 않습니다.
Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
:이 오류가 발생합니다. 다른 모든 단언 문이 통과되었습니다. 제가 잘못 가고있는 곳이나 더 많은 정보가 필요한 경우 알려주십시오.
는it("Login and post", function(done) {
superagent
.post(URL_ROOT + "/register")
.send({
email: "[email protected]",
password: "posttest"
})
.end(function(err, res) {
assert.ifError(err);
var token = res.body.token;
superagent
.post(URL_ROOT + "/post")
.send({
content: "testing post",
user: jwt.decode(token).id
})
.set("Authorization", "test_scheme " + token)
.end(function(err, res){
assert.ifError(err);
assert.equal(res.body.post.content, "testing post");
done();
});
});
});
는