2016-09-11 14:22:53 +00:00
|
|
|
"use strict";
|
|
|
|
require('typings-test');
|
|
|
|
const shelljs = require('shelljs');
|
|
|
|
const smartdata = require('../dist/index');
|
|
|
|
let mongoChildProcess;
|
|
|
|
let testDbConnection;
|
|
|
|
describe('mongodb', function () {
|
|
|
|
it('should start mongodb', function (done) {
|
2016-09-11 14:56:23 +00:00
|
|
|
this.timeout(10000);
|
2016-09-11 14:22:53 +00:00
|
|
|
mongoChildProcess = shelljs.exec('mongod --dbpath=./test/data --port 27017', { async: true });
|
2016-09-11 14:56:23 +00:00
|
|
|
setTimeout(() => { done(); }, 5000); // give mongodb it some time to complete startup
|
2016-09-11 14:22:53 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
describe('smartdata', function () {
|
|
|
|
it('should establish a connection to mongodb', function (done) {
|
|
|
|
testDbConnection = new smartdata.DbConnection('mongodb://localhost:27017/smartdata');
|
|
|
|
testDbConnection.connect().then(() => { done(); });
|
|
|
|
});
|
|
|
|
it('should create a collection', function () {
|
|
|
|
});
|
|
|
|
it('should close the db Connection', function () {
|
|
|
|
testDbConnection.close();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
describe('mongodb', function () {
|
|
|
|
it('should kill mongodb', function () {
|
2016-09-11 14:48:08 +00:00
|
|
|
shelljs.exec('mongod --dbpath=./test/data --shutdown');
|
2016-09-11 14:44:36 +00:00
|
|
|
mongoChildProcess.kill('SIGTERM');
|
2016-09-11 14:22:53 +00:00
|
|
|
});
|
|
|
|
});
|
2016-09-11 14:56:23 +00:00
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FDUCxDQUFDLENBRG9CO0FBQ3JCLE1BQVksT0FBTyxXQUFNLFNBQ3pCLENBQUMsQ0FEaUM7QUF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