Node.js 除了更新测试外,下面的一组测试正在完美执行
除了更新测试之外,下面的一组测试正在完美地执行Node.js 除了更新测试外,下面的一组测试正在完美执行,node.js,sails.js,mocha.js,sequelize.js,waterline,Node.js,Sails.js,Mocha.js,Sequelize.js,Waterline,除了更新测试之外,下面的一组测试正在完美地执行 'describe.only('UsersModel', function() { describe('#create()', function() { it('should check create function', function (done) { var newUser = { firstname: "fname", email: "myemail@gmail.com"};
'describe.only('UsersModel', function() {
describe('#create()', function() {
it('should check create function', function (done) {
var newUser = { firstname: "fname", email: "myemail@gmail.com"};
User.create(newUser)
.then(function(results) {
// some tests
done();
})
.catch(done);
});
});
describe('#find()', function() {
it('should check find function', function (done) {
User.findAll()
.then(function(results) {
// some tests
done();
})
.catch(done);
});
});
describe('#update()', function() {
it('should check update function', function (done) {
User.update()
.then(function(results) {
// some tests
done();
})
.catch(done);
});
});
describe('#destroy()', function() {
it('should check destroy function', function (done) {
User.destroy()
.then(function(results) {
// some tests
done();
})
.catch(done);
});
});
});
一,。UsersModel#find()应检查find函数:
[错误(E_未知)遇到意外错误]详细信息:错误:在吃水线>=0.9时,findAll()已被弃用,取而代之的是find()。
错误:超过2000毫秒的超时时间。确保在此测试中调用了done()回调。
在空。(C:\Users\acer\AppData\Roaming\npm\node\u modules\mocha\lib\runnable.js:189:19)
你看过日志了吗 1) 它说
findAll()
已被弃用,取而代之的是find()
。因此,您需要将findAll()
替换为find()
2) 下一个。它表示“超过了2000毫秒的超时时间。请确保在此测试中调用了done()回调”。如何使用参数调用update()
,而不仅仅是空函数?水线需要更新什么?您需要指定要更新的内容等
it('Should check update function', function (done) {
User
.update('<USER_ID>', {key: value})
.then(function(results) {
// some tests
done();
})
.catch(done);
});
it('Should check update function',函数(done){
使用者
.update(“”,{key:value})
.然后(函数(结果){
//一些测试
完成();
})
.接住(完成);
});
it('Should check find function', function (done) {
User
.find()
.then(function(results) {
// some tests
done();
})
.catch(done);
});
it('Should check update function', function (done) {
User
.update('<USER_ID>', {key: value})
.then(function(results) {
// some tests
done();
})
.catch(done);
});