From 42aa9f9f8aa7d17e2ad37e0b0597e5da48823234 Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Fri, 12 Nov 2021 18:12:59 +0100 Subject: [PATCH] fix(core): update --- test/test.easystore.ts | 10 +++++++--- test/test.ts | 10 +++++++--- test/test.typescript.ts | 10 +++++++--- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/test/test.easystore.ts b/test/test.easystore.ts index 500ec49..600ea0b 100644 --- a/test/test.easystore.ts +++ b/test/test.easystore.ts @@ -19,7 +19,7 @@ let testDb: smartdata.SmartdataDb; let smartdataOptions: smartdata.IMongoDescriptor; let mongod: mongoPlugin.MongoMemoryServer; -tap.test('should create a testinstance as database', async () => { +tap.skip.test('should create a testinstance as database', async () => { mongod = await mongoPlugin.MongoMemoryServer.create(); console.log('created mongod instance'); console.log('mongod started'); @@ -31,7 +31,7 @@ tap.test('should create a testinstance as database', async () => { await testDb.init(); }); -tap.skip.test('should connect to atlas', async (tools) => { +tap.test('should connect to atlas', async (tools) => { const databaseName = `test-smartdata-${smartunique.shortId()}`; testDb = new smartdata.SmartdataDb({ mongoDbUrl: testQenv.getEnvVarOnDemand('MONGO_URL'), @@ -53,7 +53,11 @@ tap.test('should create an easystore', async () => { }); tap.test('close', async () => { - await mongod.stop(); + if (mongod) { + await mongod.stop(); + } else { + await testDb.mongoDb.dropDatabase(); + } await testDb.close(); }); diff --git a/test/test.ts b/test/test.ts index edee040..8a376d0 100644 --- a/test/test.ts +++ b/test/test.ts @@ -21,7 +21,7 @@ let mongod: mongoPlugin.MongoMemoryServer; const totalCars = 2000; -tap.test('should create a testinstance as database', async () => { +tap.skip.test('should create a testinstance as database', async () => { mongod = await mongoPlugin.MongoMemoryServer.create(); console.log('created mongod instance'); console.log('mongod started'); @@ -33,7 +33,7 @@ tap.test('should create a testinstance as database', async () => { await testDb.init(); }); -tap.skip.test('should connect to atlas', async (tools) => { +tap.test('should connect to atlas', async (tools) => { const databaseName = `test-smartdata-${smartunique.shortId()}`; testDb = new smartdata.SmartdataDb({ mongoDbUrl: testQenv.getEnvVarOnDemand('MONGO_URL'), @@ -211,7 +211,11 @@ tap.test('should use a cursor', async () => { // close the database connection // ======================================= tap.test('close', async () => { - await mongod.stop(); + if (mongod) { + await mongod.stop(); + } else { + await testDb.mongoDb.dropDatabase(); + } await testDb.close(); }); diff --git a/test/test.typescript.ts b/test/test.typescript.ts index b3ea0bd..3a3fab1 100644 --- a/test/test.typescript.ts +++ b/test/test.typescript.ts @@ -21,7 +21,7 @@ let mongod: mongoPlugin.MongoMemoryServer; const totalCars = 2000; -tap.test('should create a testinstance as database', async () => { +tap.skip.test('should create a testinstance as database', async () => { mongod = await mongoPlugin.MongoMemoryServer.create(); console.log('created mongod instance'); console.log('mongod started'); @@ -33,7 +33,7 @@ tap.test('should create a testinstance as database', async () => { await testDb.init(); }); -tap.skip.test('should connect to atlas', async (tools) => { +tap.test('should connect to atlas', async (tools) => { const databaseName = `test-smartdata-${smartunique.shortId()}`; testDb = new smartdata.SmartdataDb({ mongoDbUrl: testQenv.getEnvVarOnDemand('MONGO_URL'), @@ -93,7 +93,11 @@ tap.test('should get a car', async () => { // close the database connection // ======================================= tap.test('close', async () => { - await mongod.stop(); + if (mongod) { + await mongod.stop(); + } else { + await testDb.mongoDb.dropDatabase(); + } await testDb.close(); });