mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-06-22 14:02:30 +00:00
Fix tests
This commit is contained in:
parent
e6a497fe44
commit
b75b46821b
@ -23,22 +23,24 @@ let ipfs, ipfsDaemon;
|
|||||||
const IpfsApis = [
|
const IpfsApis = [
|
||||||
{
|
{
|
||||||
// js-ipfs
|
// js-ipfs
|
||||||
|
name: 'js-ipfs',
|
||||||
start: () => {
|
start: () => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const IPFS = require('ipfs')
|
const IPFS = require('ipfs')
|
||||||
const ipfs = new IPFS('/tmp/orbitdbtest');
|
const ipfs = new IPFS('/tmp/orbitdbtest');
|
||||||
// resolve(ipfs);
|
resolve(ipfs);
|
||||||
ipfs.goOnline((err) => {
|
// ipfs.goOnline((err) => {
|
||||||
if(err) reject(err)
|
// if(err) reject(err)
|
||||||
resolve(ipfs)
|
// resolve(ipfs)
|
||||||
});
|
// });
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// stop: () => Promise.resolve()
|
stop: () => Promise.resolve()
|
||||||
stop: () => new Promise((resolve, reject) => ipfs.goOffline(resolve))
|
// stop: () => new Promise((resolve, reject) => ipfs.goOffline(resolve))
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// js-ipfs-api via local daemon
|
// js-ipfs-api via local daemon
|
||||||
|
name: 'js-ipfs-api',
|
||||||
start: () => {
|
start: () => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
ipfsd.disposableApi((err, ipfs) => {
|
ipfsd.disposableApi((err, ipfs) => {
|
||||||
@ -64,7 +66,7 @@ OrbitServer.start();
|
|||||||
|
|
||||||
IpfsApis.forEach(function(ipfsApi) {
|
IpfsApis.forEach(function(ipfsApi) {
|
||||||
|
|
||||||
describe('Orbit Client', function() {
|
describe('Orbit Client with ' + ipfsApi.name, function() {
|
||||||
this.timeout(40000);
|
this.timeout(40000);
|
||||||
|
|
||||||
let client, client2, db;
|
let client, client2, db;
|
||||||
|
@ -25,16 +25,36 @@ const IpfsApis = [
|
|||||||
start: () => {
|
start: () => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const IPFS = require('ipfs')
|
const IPFS = require('ipfs')
|
||||||
const ipfs = new IPFS();
|
const ipfs = new IPFS('/tmp/orbit-db-test');
|
||||||
|
const init = () => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
ipfs.init({}, (err) => {
|
||||||
|
console.log("1")
|
||||||
|
if (err) {
|
||||||
|
if (err.message === 'repo already exists') {
|
||||||
|
console.log("2", err)
|
||||||
|
return resolve();
|
||||||
|
}
|
||||||
|
return reject(err);
|
||||||
|
}
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
// resolve(ipfs);
|
// resolve(ipfs);
|
||||||
ipfs.goOnline((err) => {
|
return init().then(() => {
|
||||||
if(err) reject(err)
|
resolve(ipfs);
|
||||||
resolve(ipfs)
|
// ipfs.goOnline((err) => {
|
||||||
|
// console.log("ava")
|
||||||
|
// if(err) reject(err)
|
||||||
|
// return resolve(ipfs)
|
||||||
|
// });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// stop: () => Promise.resolve()
|
stop: () => Promise.resolve()
|
||||||
stop: () => new Promise((resolve, reject) => ipfs.goOffline(resolve))
|
// stop: () => new Promise((resolve, reject) => ipfs.goOffline(resolve))
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// js-ipfs-api via local daemon
|
// js-ipfs-api via local daemon
|
||||||
|
Loading…
x
Reference in New Issue
Block a user