mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-05-21 14:26:38 +00:00
Merge pull request #267 from orbitdb/fix/remove-stop-ipfs
Remove stopIpfs() function and use ipfs.stop()
This commit is contained in:
commit
b09a5cd767
@ -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()
|
||||
|
@ -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() {
|
||||
|
@ -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 () => {
|
||||
|
@ -27,7 +27,7 @@ describe('orbit-db - Eventlog', function() {
|
||||
|
||||
after(async () => {
|
||||
if(orbitdb1)
|
||||
orbitdb1.stop()
|
||||
await orbitdb1.stop()
|
||||
|
||||
if (ipfs)
|
||||
await ipfs.stop()
|
||||
|
@ -27,7 +27,7 @@ describe('orbit-db - Feed', function() {
|
||||
|
||||
after(async () => {
|
||||
if(orbitdb1)
|
||||
orbitdb1.stop()
|
||||
await orbitdb1.stop()
|
||||
|
||||
if (ipfs)
|
||||
await ipfs.stop()
|
||||
|
@ -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()
|
||||
|
@ -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 () => {
|
||||
|
@ -27,7 +27,7 @@ describe('orbit-db - Persistency', function() {
|
||||
|
||||
after(async () => {
|
||||
if(orbitdb1)
|
||||
orbitdb1.stop()
|
||||
await orbitdb1.stop()
|
||||
|
||||
if (ipfs)
|
||||
await ipfs.stop()
|
||||
|
@ -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() {
|
||||
|
@ -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 () => {
|
||||
|
@ -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() {
|
||||
|
@ -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
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user