我正在做一些测试,我正在测试 POST 路由,我认为测试写得很好,但是现在我收到一个错误,上面写着
“从磁盘读取文件时出错:错误:ENOENT:没有这样的文件或目录,打开'./database.json”
describe ("POST /post methods",() => {
it("should get /post ",(done)=>{
const incomingRequest = {
name: "charanjit",
content: "im posting",
gif: ""
};
chai.request(server)
.post("/posts")
.send(incomingRequest)
.end(function (err, res) {
expect(res).to.have.status(500)
done()
});
})
it("should get /comments ",(done)=>{
const commente = {
comment: "hi omg"
};
chai.request(server)
.post("/comments")
.send(commente)
.end(function (err, res) {
expect(res).to.have.status(200)
done()
});
})
it("should get /emoji ",(done)=>{
const commente = {
comment: "hi omg"
};
chai.request(server)
.post("/comments")
.send(commente)
.end(function (err, res) {
expect(res).to.have.status(200)
done()
});
是什么导致了这个错误,我是否需要编写一个访问数据库的测试,我有点困惑,我该怎么做?
 德玛西亚99
德玛西亚99 
					月关宝盒
 随时随地看视频慕课网APP
随时随地看视频慕课网APP
相关分类