저는 API를 만들고 있는데 mocha와 supertest로 테스트하려고합니다.supertest nodejs 테스트 받기
내가 올바르게 코드와 POST 호출을 테스트 해요 : 내가 실행하는 경우,
가it("Should get HTML of the selected template", function(done) {
request(app)
.get("/api/template/default/html")
.expect(200, done);
});
시험은 실패
it("Should generate a PDF based on the given data using API", function(done) {
request(app)
.post("/api/document/print")
.send({tplName: "default", tplData: { title: "Testee", p1: "paragraph"}})
.expect(200, done);
});
을하지만이 코드 GET 요청을 테스트 할 때 내 응용 프로그램과 크롬에서 나는 올바른 응답 (200)을 시도해보십시오.
내가 뭘 잘못하고 있니?
잘 모르겠습니다. 테스트가 실패하면 테스트는 무엇을 말합니까? –
잘하고 있습니다. 그것은 단지 실패합니다. –
테스트 결과 * 출력이 안되니? –