2
0
mirror of https://github.com/frappe/books.git synced 2024-11-14 01:14:03 +00:00
books/tests/helpers.js

17 lines
410 B
JavaScript
Raw Normal View History

const frappe = require('frappejs');
2019-12-09 19:57:26 +00:00
const server = require('frappejs/server');
const SQLite = require('frappejs/backends/sqlite');
2018-01-12 12:25:07 +00:00
module.exports = {
2019-12-09 19:57:26 +00:00
async initSqlite({ dbPath = '_test.db', models } = {}) {
server.init();
if (models) {
frappe.registerModels(models, 'server');
2018-01-12 12:25:07 +00:00
}
2019-12-09 19:57:26 +00:00
frappe.db = new SQLite({ dbPath });
await frappe.db.connect();
await frappe.db.migrate();
}
};