私は私のノード/ ExpressのAPIをテストするために、モカとチャイを使用していて、テストが.END()ここでチャイは
に到達していない理由を私は理解することはできませんが、テストである().ENDに達していません:
it('should authenticate successfully with user credentials', function (done) {
agent
.post('/login')
.set('Content-Type', 'application/x-www-form-urlencoded')
.send({ 'username': 'username', 'password': 'password'})
.end(function (err, res) {
console.log(res);
console.log('***************************Authenticated*********************************************');
expect(res).to.have.status(200);
});
done();
});
そして、ここでは、私が当たっていますルートである:私は私の問題ではなく正式な応答が、リダイレクトが存在しないという事実であることも理解
app.post('/login', passport.authenticate('ldapauth', { successRedirect: '/' }));
が、私はわかりませんそれをどう扱うか。
'done()'を 'end'ハンドラの_inside_に移動することから始めてください。 – robertklep