init commit
This commit is contained in:
parent
ae639426d0
commit
7a491681cc
257 changed files with 95524 additions and 80 deletions
34
test/testutil/db.js
Normal file
34
test/testutil/db.js
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
const Promise = require('bluebird');
|
||||
|
||||
function MockDB(mockTx) {
|
||||
this.mockTx = mockTx;
|
||||
}
|
||||
|
||||
MockDB.prototype = {
|
||||
runTransaction: function runTransaction(fn) {
|
||||
return fn(this.mockTx);
|
||||
}
|
||||
};
|
||||
|
||||
function MockTx() {
|
||||
|
||||
}
|
||||
|
||||
[
|
||||
'del',
|
||||
'distinct',
|
||||
'insert',
|
||||
'limit',
|
||||
'orderBy',
|
||||
'select',
|
||||
'table',
|
||||
'update',
|
||||
'where',
|
||||
].forEach(method => {
|
||||
MockTx.prototype[method] = function () {
|
||||
return Promise.reject(new Error(`No stub defined for method "${method}"`));
|
||||
};
|
||||
});
|
||||
|
||||
exports.MockDB = MockDB;
|
||||
exports.MockTx = MockTx;
|
||||
Loading…
Add table
Add a link
Reference in a new issue