2
0
mirror of https://github.com/frappe/books.git synced 2024-12-23 11:29:03 +00:00

test(REST): Initialize models before testing

This commit is contained in:
Faris Ansari 2018-09-14 23:16:30 +05:30
parent 06c06a81cb
commit 2950a368c0
2 changed files with 7 additions and 4 deletions

View File

@ -25,8 +25,6 @@ require.extensions['.html'] = function (module, filename) {
module.exports = fs.readFileSync(filename, 'utf8');
};
process.env.NODE_ENV = 'development';
module.exports = {
async start({backend, connectionParams, models, authConfig=null}) {
await this.init();

View File

@ -4,23 +4,28 @@ const fetch = require('node-fetch');
const { spawn } = require('child_process');
const process = require('process');
const HTTPClient = require('frappejs/backends/http')
const utils = require('frappejs/utils');
const models = require('frappejs/models');
const common = require('frappejs/common');
// create a copy of frappe
var test_server;
describe('REST', () => {
describe.only('REST', () => {
before(async function() {
test_server = spawn('node', ['tests/test_server.js'], { stdio: 'inherit' });
await frappe.init();
await frappe.registerLibs(common);
await frappe.registerModels(models);
await frappe.login('Administrator');
frappe.db = await new HTTPClient({server: 'localhost:8000'});
frappe.fetch = fetch;
// wait for server to start
return await frappe.sleep(2);
return await utils.sleep(2);
});
after(() => {