Wait for database to close in tests

This commit is contained in:
haad 2018-03-17 09:52:16 +02:00
parent 51b79745a7
commit 40dc6e4340
4 changed files with 7 additions and 7 deletions

View File

@ -51,12 +51,12 @@ describe('CounterStore', function() {
orbitdb2 = new OrbitDB(ipfs2, './orbitdb/2') orbitdb2 = new OrbitDB(ipfs2, './orbitdb/2')
}) })
afterEach(() => { afterEach(async () => {
if (orbitdb1) if (orbitdb1)
orbitdb1.stop() await orbitdb1.stop()
if (orbitdb2) if (orbitdb2)
orbitdb2.stop() await orbitdb2.stop()
}) })
describe('counters', function() { describe('counters', function() {

View File

@ -31,7 +31,7 @@ describe('orbit-db - Create & Open', function() {
after(async () => { after(async () => {
if(orbitdb) if(orbitdb)
orbitdb.stop() await orbitdb.stop()
if (ipfs) if (ipfs)
await ipfs.stop() await ipfs.stop()

View File

@ -36,7 +36,7 @@ describe('orbit-db - Create custom type', function () {
}) })
after(async () => { after(async () => {
if(orbitdb) orbitdb.stop() if (orbitdb) await orbitdb.stop()
if (ipfs) await ipfs.stop() if (ipfs) await ipfs.stop()
}) })

View File

@ -27,7 +27,7 @@ describe('orbit-db - Drop Database', function() {
after(async () => { after(async () => {
if(orbitdb) if(orbitdb)
orbitdb.stop() await orbitdb.stop()
if (ipfs) if (ipfs)
await ipfs.stop() await ipfs.stop()
@ -45,6 +45,6 @@ describe('orbit-db - Drop Database', function() {
it('removes local database files', async () => { it('removes local database files', async () => {
await db.drop() await db.drop()
assert.equal(fs.existsSync(localDataPath), false) assert.equal(fs.existsSync(localDataPath), false)
}) })
}) })
}) })