Tôi cần một số trợ giúp để giải quyết vấn đề của mình bằng cách kiểm tra mã nút. Tôi đang sử dụng mocha và supertest. Tôi đang bối rối với việc thực hiện trong supertest. Tôi không biết để giải quyết nó. Tôi đang cố gắng tự động tải xuống tệp.LoạiError: Không thể đọc địa chỉ 'thuộc tính' của supertest sup1est
`describe('GET /entry/:entryId/file/:id/download', function(){
it('should pass download function', function(done){
this.timeout(15000);
request(app.webServer)
.get('/entry/543CGsdadtrE/file/wDRDasdDASAS/download')
.set('Authorization', 'Bearer eyJ0eXAiOiJKV1QiLCJhbGco')
.expect(200)
.end(function(err, res){
if (err) return done(err);
console.log(err, res);
done();
});
});
});
tôi đã bao gồm nó cảm ơn bạn tôi hy vọng bạn có thể giúp tôi bro – Saitama
nó nói rằng theres một vấn đề với /node-modules/supertest/lib/test.js. và khi tôi nhìn vào test.js tôi tìm thấy điều này – Saitama
'Test.prototype.serverAddress = function (ứng dụng, đường dẫn) { var addr = app.address(); nếu (! Addr) this._server = app.listen (0); cổng var = app.address(). Port; giao thức var = ứng dụng instanceof https.Server? 'https': 'http'; giao thức trả lại + ': //127.0.0.1:' + cổng + đường dẫn; }; ' – Saitama