diff --git a/test/counterdb.test.js b/test/counterdb.test.js index a4986ba..ecb96b1 100644 --- a/test/counterdb.test.js +++ b/test/counterdb.test.js @@ -34,10 +34,10 @@ describe('CounterStore', function() { after(async () => { if (orbitdb1) - orbitdb1.stop() + await orbitdb1.stop() if (orbitdb2) - orbitdb2.stop() + await orbitdb2.stop() if (ipfs1) await ipfs1.stop() diff --git a/test/create-open.test.js b/test/create-open.test.js index b2e4b6f..88b2c81 100644 --- a/test/create-open.test.js +++ b/test/create-open.test.js @@ -10,7 +10,6 @@ const OrbitDBAddress = require('../src/orbit-db-address') const { first, last } = require('./utils/test-utils') const config = require('./utils/config') const startIpfs = require('./utils/start-ipfs') -const stopIpfs = require('./utils/stop-ipfs') const dbPath = './orbitdb/tests/create-open' const ipfsPath = './orbitdb/tests/create-open/ipfs' @@ -34,7 +33,7 @@ describe('orbit-db - Create & Open', function() { orbitdb.stop() if (ipfs) - await stopIpfs(ipfs) + await ipfs.stop() }) describe('Create', function() { diff --git a/test/docstore.test.js b/test/docstore.test.js index 28ad4bd..ee7fd62 100644 --- a/test/docstore.test.js +++ b/test/docstore.test.js @@ -21,12 +21,12 @@ describe('orbit-db - Document Store', function() { orbitdb1 = new OrbitDB(ipfs, dbPath + '/1') }) - after(() => { + after(async () => { if(orbitdb1) - orbitdb1.disconnect() + await orbitdb1.stop() if (ipfs) - ipfs.stop() + await ipfs.stop() }) it('creates and opens a database', async () => { diff --git a/test/eventlog.test.js b/test/eventlog.test.js index e94d378..c50b227 100644 --- a/test/eventlog.test.js +++ b/test/eventlog.test.js @@ -27,7 +27,7 @@ describe('orbit-db - Eventlog', function() { after(async () => { if(orbitdb1) - orbitdb1.stop() + await orbitdb1.stop() if (ipfs) await ipfs.stop() diff --git a/test/feed.test.js b/test/feed.test.js index 7c62b13..c5d730f 100644 --- a/test/feed.test.js +++ b/test/feed.test.js @@ -27,7 +27,7 @@ describe('orbit-db - Feed', function() { after(async () => { if(orbitdb1) - orbitdb1.stop() + await orbitdb1.stop() if (ipfs) await ipfs.stop() diff --git a/test/kvstore.test.js b/test/kvstore.test.js index b5f5be5..5c823b4 100644 --- a/test/kvstore.test.js +++ b/test/kvstore.test.js @@ -24,7 +24,7 @@ describe('orbit-db - Key-Value Store', function() { after(async () => { if(orbitdb1) - orbitdb1.stop() + await orbitdb1.stop() if (ipfs) await ipfs.stop() diff --git a/test/multiple-databases.test.js b/test/multiple-databases.test.js index c62a717..9aeecbf 100644 --- a/test/multiple-databases.test.js +++ b/test/multiple-databases.test.js @@ -6,7 +6,6 @@ const rmrf = require('rimraf') const OrbitDB = require('../src/OrbitDB') const config = require('./utils/config') const startIpfs = require('./utils/start-ipfs') -const stopIpfs = require('./utils/stop-ipfs') const waitForPeers = require('./utils/wait-for-peers') const dbPath1 = './orbitdb/tests/multiple-databases/1' @@ -83,10 +82,10 @@ describe('orbit-db - Multiple Databases', function() { await orbitdb2.stop() if (ipfs1) - await stopIpfs(ipfs1) + await ipfs1.stop() if (ipfs2) - await stopIpfs(ipfs2) + await ipfs2.stop() }) beforeEach(async () => { diff --git a/test/persistency.js b/test/persistency.js index 60349d9..0fd6cda 100644 --- a/test/persistency.js +++ b/test/persistency.js @@ -27,7 +27,7 @@ describe('orbit-db - Persistency', function() { after(async () => { if(orbitdb1) - orbitdb1.stop() + await orbitdb1.stop() if (ipfs) await ipfs.stop() diff --git a/test/replicate-and-load.test.js b/test/replicate-and-load.test.js index f7c8deb..607a3b4 100644 --- a/test/replicate-and-load.test.js +++ b/test/replicate-and-load.test.js @@ -6,7 +6,6 @@ const rmrf = require('rimraf') const OrbitDB = require('../src/OrbitDB') const config = require('./utils/config') const startIpfs = require('./utils/start-ipfs') -const stopIpfs = require('./utils/stop-ipfs') const waitForPeers = require('./utils/wait-for-peers') const dbPath1 = './orbitdb/tests/replicate-and-load/1' @@ -43,10 +42,10 @@ describe('orbit-db - Replicate and Load', function() { await orbitdb2.stop() if (ipfs1) - await stopIpfs(ipfs1) + await ipfs1.stop() if (ipfs2) - await stopIpfs(ipfs2) + await ipfs2.stop() }) describe('two peers', function() { diff --git a/test/replicate-automatically.test.js b/test/replicate-automatically.test.js index 8c53b2c..40751aa 100644 --- a/test/replicate-automatically.test.js +++ b/test/replicate-automatically.test.js @@ -6,7 +6,6 @@ const rmrf = require('rimraf') const OrbitDB = require('../src/OrbitDB') const config = require('./utils/config') const startIpfs = require('./utils/start-ipfs') -const stopIpfs = require('./utils/stop-ipfs') const waitForPeers = require('./utils/wait-for-peers') const dbPath1 = './orbitdb/tests/replicate-automatically/1' @@ -43,10 +42,10 @@ describe('orbit-db - Automatic Replication', function() { await orbitdb2.stop() if (ipfs1) - await stopIpfs(ipfs1) + await ipfs1.stop() if (ipfs2) - await stopIpfs(ipfs2) + await ipfs2.stop() }) beforeEach(async () => { diff --git a/test/replicate.test.js b/test/replicate.test.js index aced74b..5dbb095 100644 --- a/test/replicate.test.js +++ b/test/replicate.test.js @@ -6,7 +6,6 @@ const rmrf = require('rimraf') const OrbitDB = require('../src/OrbitDB') const config = require('./utils/config') const startIpfs = require('./utils/start-ipfs') -const stopIpfs = require('./utils/stop-ipfs') const waitForPeers = require('./utils/wait-for-peers') const dbPath1 = './orbitdb/tests/replication/1' @@ -43,10 +42,10 @@ describe('orbit-db - Replication', function() { await orbitdb2.stop() if (ipfs1) - await stopIpfs(ipfs1) + await ipfs1.stop() if (ipfs2) - await stopIpfs(ipfs2) + await ipfs2.stop() }) describe('two peers', function() { diff --git a/test/utils/stop-ipfs.js b/test/utils/stop-ipfs.js deleted file mode 100644 index f76edd6..0000000 --- a/test/utils/stop-ipfs.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict' - -const IPFS = require('ipfs') - -/** - * Stop an IPFS instance - * @param {[IPFS]} ipfs [IPFS instance to stop] - * @return {[Promise]} [Empty] - */ -const stopIpfs = (ipfs) => { - return new Promise((resolve, reject) => { - // TODO: ipfs.stop() should return a Promise, PR it in github/js-ipfs - ipfs.stop((err) => { - if (err) { - reject(err) - } else { - resolve() - } - }) - }) -} - -module.exports = stopIpfs diff --git a/test/write-permissions.test.js b/test/write-permissions.test.js index cca3e6b..53b199d 100644 --- a/test/write-permissions.test.js +++ b/test/write-permissions.test.js @@ -68,10 +68,10 @@ describe('orbit-db - Write Permissions', function() { after(async () => { if(orbitdb1) - orbitdb1.stop() + await orbitdb1.stop() if(orbitdb2) - orbitdb2.stop() + await orbitdb2.stop() if (ipfs) await ipfs.stop()