smartdata/test/test.js

34 lines
2.6 KiB
JavaScript

"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) {
mongoChildProcess = shelljs.exec('mongod --dbpath=./test/data --port 27017', { async: true });
setTimeout(() => { done(); }, 1500);
});
});
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 () {
if (process.env.CI === "true") {
mongoChildProcess.kill('SIGKILL');
}
else {
mongoChildProcess.kill('SIGTERM');
}
});
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FDUCxDQUFDLENBRG9CO0FBQ3JCLE1BQVksT0FBTyxXQUFNLFNBQ3pCLENBQUMsQ0FEaUM7QUFFbEMsTUFBWSxTQUFTLFdBQU0sZUFHM0IsQ0FBQyxDQUh5QztBQUcxQyxJQUFJLGlCQUFpQixDQUFBO0FBQ3JCLElBQUksZ0JBQXdDLENBQUE7QUFHNUMsUUFBUSxDQUFDLFNBQVMsRUFBQztJQUNmLEVBQUUsQ0FBQyxzQkFBc0IsRUFBQyxVQUFTLElBQUk7UUFDbkMsaUJBQWlCLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQywwQ0FBMEMsRUFBQyxFQUFDLEtBQUssRUFBRSxJQUFJLEVBQUMsQ0FBQyxDQUFBO1FBQzFGLFVBQVUsQ0FBQyxRQUFRLElBQUksRUFBRSxDQUFBLENBQUMsQ0FBQyxFQUFFLElBQUksQ0FBQyxDQUFBO0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