From 40dc6e434074321838208ded3652b4a9bb27be79 Mon Sep 17 00:00:00 2001 From: haad Date: Sat, 17 Mar 2018 09:52:16 +0200 Subject: [PATCH] Wait for database to close in tests --- test/counterdb.test.js | 6 +++--- test/create-open.test.js | 2 +- test/create-type.test.js | 2 +- test/drop.test.js | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/counterdb.test.js b/test/counterdb.test.js index b81d978..7120110 100644 --- a/test/counterdb.test.js +++ b/test/counterdb.test.js @@ -51,12 +51,12 @@ describe('CounterStore', function() { orbitdb2 = new OrbitDB(ipfs2, './orbitdb/2') }) - afterEach(() => { + afterEach(async () => { if (orbitdb1) - orbitdb1.stop() + await orbitdb1.stop() if (orbitdb2) - orbitdb2.stop() + await orbitdb2.stop() }) describe('counters', function() { diff --git a/test/create-open.test.js b/test/create-open.test.js index acc707c..3277337 100644 --- a/test/create-open.test.js +++ b/test/create-open.test.js @@ -31,7 +31,7 @@ describe('orbit-db - Create & Open', function() { after(async () => { if(orbitdb) - orbitdb.stop() + await orbitdb.stop() if (ipfs) await ipfs.stop() diff --git a/test/create-type.test.js b/test/create-type.test.js index c6870b7..b9d8764 100644 --- a/test/create-type.test.js +++ b/test/create-type.test.js @@ -36,7 +36,7 @@ describe('orbit-db - Create custom type', function () { }) after(async () => { - if(orbitdb) orbitdb.stop() + if (orbitdb) await orbitdb.stop() if (ipfs) await ipfs.stop() }) diff --git a/test/drop.test.js b/test/drop.test.js index ff26dcb..2d249b0 100644 --- a/test/drop.test.js +++ b/test/drop.test.js @@ -27,7 +27,7 @@ describe('orbit-db - Drop Database', function() { after(async () => { if(orbitdb) - orbitdb.stop() + await orbitdb.stop() if (ipfs) await ipfs.stop() @@ -45,6 +45,6 @@ describe('orbit-db - Drop Database', function() { it('removes local database files', async () => { await db.drop() assert.equal(fs.existsSync(localDataPath), false) - }) + }) }) })