尝试设置一些事件侦听器以加载图像时,出现以下错误。
passport.authenticate = sinon.stub( passport, 'authenticate' )
.returns(
( req, res, next ) => {
const user = {
username: 'test user',
email: 'testuser@mail.com',
displayName: 'Test User',
provider: 'testCase',
roles: [ 'admin' ]
}
req.user = user;
next()
}
);
答案 0 :(得分:0)
由于添加事件侦听器时使用了粗箭头功能,因此还需要将其用作第二个参数,如下所示:
t1