0
嘗試新元素插入到我的MongoDB數據庫,當我使用終端「NPM運行測試」它給了我這個錯誤:確保「完成()」被稱爲JS錯誤
Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure
"done()" is called; if returning a Promise, ensure it resolves.
這裏是我的代碼保存一個元素到我的DB:
const mocha = require('mocha');
const assert = require('assert');
const PPB = require('../Models/Pingpongballs');
describe('Saving records', function() {
it('Saves record to db', function(done) {
var ppball = new PPB ({
amount: 5
});
ppball.save().then(function() {
assert(ppball.isNew === false);
done();
});
});
});
離開了'done'說法,雖然:d – robertklep
@robertklep刪除,謝謝。 – alexmac
你可以刪除返回null – Denis