Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
f50a61308c | |||
42aa9f9f8a | |||
3f591ff9d8 | |||
7b33347b4c |
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartdata",
|
"name": "@pushrocks/smartdata",
|
||||||
"version": "4.0.21",
|
"version": "4.0.23",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@pushrocks/smartdata",
|
"name": "@pushrocks/smartdata",
|
||||||
"version": "4.0.21",
|
"version": "4.0.23",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/lik": "^5.0.0",
|
"@pushrocks/lik": "^5.0.0",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartdata",
|
"name": "@pushrocks/smartdata",
|
||||||
"version": "4.0.21",
|
"version": "4.0.23",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "do more with data",
|
"description": "do more with data",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
|
@ -37,6 +37,7 @@ tap.test('should connect to atlas', async (tools) => {
|
|||||||
mongoDbUrl: testQenv.getEnvVarOnDemand('MONGO_URL'),
|
mongoDbUrl: testQenv.getEnvVarOnDemand('MONGO_URL'),
|
||||||
mongoDbName: databaseName,
|
mongoDbName: databaseName,
|
||||||
});
|
});
|
||||||
|
await testDb.init();
|
||||||
});
|
});
|
||||||
|
|
||||||
let easyStore: smartdata.EasyStore<{
|
let easyStore: smartdata.EasyStore<{
|
||||||
@ -52,11 +53,12 @@ tap.test('should create an easystore', async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
tap.test('close', async () => {
|
tap.test('close', async () => {
|
||||||
testDb.close();
|
if (mongod) {
|
||||||
mongod.stop();
|
await mongod.stop();
|
||||||
setTimeout(() => {
|
} else {
|
||||||
process.exit(0);
|
await testDb.mongoDb.dropDatabase();
|
||||||
}, 1000);
|
}
|
||||||
|
await testDb.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.start();
|
tap.start();
|
||||||
|
15
test/test.ts
15
test/test.ts
@ -30,6 +30,7 @@ tap.skip.test('should create a testinstance as database', async () => {
|
|||||||
};
|
};
|
||||||
console.log(smartdataOptions);
|
console.log(smartdataOptions);
|
||||||
testDb = new smartdata.SmartdataDb(smartdataOptions);
|
testDb = new smartdata.SmartdataDb(smartdataOptions);
|
||||||
|
await testDb.init();
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('should connect to atlas', async (tools) => {
|
tap.test('should connect to atlas', async (tools) => {
|
||||||
@ -38,9 +39,6 @@ tap.test('should connect to atlas', async (tools) => {
|
|||||||
mongoDbUrl: testQenv.getEnvVarOnDemand('MONGO_URL'),
|
mongoDbUrl: testQenv.getEnvVarOnDemand('MONGO_URL'),
|
||||||
mongoDbName: databaseName,
|
mongoDbName: databaseName,
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
tap.test('should establish a connection to mongod', async () => {
|
|
||||||
await testDb.init();
|
await testDb.init();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -212,12 +210,13 @@ tap.test('should use a cursor', async () => {
|
|||||||
// =======================================
|
// =======================================
|
||||||
// close the database connection
|
// close the database connection
|
||||||
// =======================================
|
// =======================================
|
||||||
tap.test('should drop the db and close the database connection', async (tools) => {
|
tap.test('close', async () => {
|
||||||
await testDb.mongoDb.dropDatabase();
|
if (mongod) {
|
||||||
await testDb.close();
|
|
||||||
try {
|
|
||||||
await mongod.stop();
|
await mongod.stop();
|
||||||
} catch (e) {}
|
} else {
|
||||||
|
await testDb.mongoDb.dropDatabase();
|
||||||
|
}
|
||||||
|
await testDb.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.start({ throwOnError: true });
|
tap.start({ throwOnError: true });
|
||||||
|
@ -30,6 +30,7 @@ tap.skip.test('should create a testinstance as database', async () => {
|
|||||||
};
|
};
|
||||||
console.log(smartdataOptions);
|
console.log(smartdataOptions);
|
||||||
testDb = new smartdata.SmartdataDb(smartdataOptions);
|
testDb = new smartdata.SmartdataDb(smartdataOptions);
|
||||||
|
await testDb.init();
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('should connect to atlas', async (tools) => {
|
tap.test('should connect to atlas', async (tools) => {
|
||||||
@ -38,9 +39,6 @@ tap.test('should connect to atlas', async (tools) => {
|
|||||||
mongoDbUrl: testQenv.getEnvVarOnDemand('MONGO_URL'),
|
mongoDbUrl: testQenv.getEnvVarOnDemand('MONGO_URL'),
|
||||||
mongoDbName: databaseName,
|
mongoDbName: databaseName,
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
tap.test('should establish a connection to mongod', async () => {
|
|
||||||
await testDb.init();
|
await testDb.init();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -94,12 +92,13 @@ tap.test('should get a car', async () => {
|
|||||||
// =======================================
|
// =======================================
|
||||||
// close the database connection
|
// close the database connection
|
||||||
// =======================================
|
// =======================================
|
||||||
tap.test('should close the database connection', async (tools) => {
|
tap.test('close', async () => {
|
||||||
await testDb.mongoDb.dropDatabase();
|
if (mongod) {
|
||||||
await testDb.close();
|
|
||||||
try {
|
|
||||||
await mongod.stop();
|
await mongod.stop();
|
||||||
} catch (e) {}
|
} else {
|
||||||
|
await testDb.mongoDb.dropDatabase();
|
||||||
|
}
|
||||||
|
await testDb.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.start({ throwOnError: true });
|
tap.start({ throwOnError: true });
|
||||||
|
Reference in New Issue
Block a user