<commit_before>'use strict';

const assert      = require('assert');
const Promise     = require('bluebird');
const rimraf      = require('rimraf')
const ipfsd       = require('ipfsd-ctl');
const OrbitClient = require('../src/Client');
const OrbitServer = require('orbit-server/src/server');

// Mute logging
require('logplease').setLogLevel('ERROR');

const username  = 'testrunner';
const username2 = 'rennurtset';

const ipfsPath = '/tmp/orbittests';

const startIpfs = () => {
  return new Promise((resolve, reject) => {
    // ipfsd.local(ipfsPath, (err, node) => {
    //   if(err) reject(err);
    //   node.startDaemon((err, ipfs) => {
    //     if(err) reject(err);
    //     resolve(ipfs);
    //   });
    // });
    OrbitServer.start();
    ipfsd.disposableApi((err, ipfs) => {
      if(err) reject(err);
      resolve(ipfs);
    });
  });
};

describe('Orbit Client', function() {
  this.timeout(20000);

  let ipfs, client1, client2;

  before((done) => {
    rimraf.sync('./orbit-db-cache.json')
    startIpfs().then((res) => {
      ipfs = res;
      Promise.map([username, username2], (login) => {
        return OrbitClient.connect('localhost', 3333, login, '', ipfs, { allowOffline: false, cacheFile: './orbit-db-cache.json' });
      }).then((clients) => {
        client1 = clients[0];
        client2 = clients[1];
        done();
      }).catch((e) => {
        console.log(e.stack);
        assert.equal(e, null);
      });
    });
  });

  after((done) => {
    if(client1) client1.disconnect();
    if(client2) client2.disconnect();<commit_msg>Remove orbit-common from dependencies. Use latest orbit-server package.<commit_after>'use strict';

const assert      = require('assert');
const Promise     = require('bluebird');
const rimraf      = require('rimraf')
const ipfsd       = require('ipfsd-ctl');
const OrbitClient = require('../src/Client');
const OrbitServer = require('orbit-server/src/server');

// Mute logging
require('logplease').setLogLevel('ERROR');

const username  = 'testrunner';
const username2 = 'rennurtset';

const ipfsPath = '/tmp/orbittests';

const startIpfs = () => {
  return new Promise((resolve, reject) => {
    // ipfsd.local(ipfsPath, (err, node) => {
    //   if(err) reject(err);
    //   node.startDaemon((err, ipfs) => {
    //     if(err) reject(err);
    //     resolve(ipfs);
    //   });
    // });
    OrbitServer.start();
    ipfsd.disposableApi((err, ipfs) => {
      if(err) reject(err);
      resolve(ipfs);
    });
  });
};

describe('CounterStore', function() {
  this.timeout(20000);

  let ipfs, client1, client2;

  before((done) => {
    rimraf.sync('./orbit-db-cache.json')
    startIpfs().then((res) => {
      ipfs = res;
      Promise.map([username, username2], (login) => {
        return OrbitClient.connect('localhost', 3333, login, '', ipfs, { allowOffline: false, cacheFile: './orbit-db-cache.json' });
      }).then((clients) => {
        client1 = clients[0];
        client2 = clients[1];
        done();
      }).catch((e) => {
        console.log(e.stack);
        assert.equal(e, null);
      });
    });
  });

  after((done) => {
    if(client1) client1.disconnect();
    if(client2) client2.disconnect();
{'fraction_non_alphanumeric': 0.1942535915053092, 'fraction_numerical': 0.01311680199875078, 'mean_word_length': 2.8543922984356196, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6502743', 'n_tokens_mistral': 1090, 'n_tokens_neox': 1057, 'n_words': 193}