Skip to content
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.

Commit

Permalink
fix: daemon type in tests (#18)
Browse files Browse the repository at this point in the history
* fix: daemon type in tests

* fix: dont specify type twise
  • Loading branch information
dryajov authored and daviddias committed Mar 19, 2018
1 parent 9241cc7 commit 2fbde7b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
10 changes: 6 additions & 4 deletions test/exchange-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const chai = require('chai')
const dirtyChai = require('dirty-chai')
const expect = chai.expect
chai.use(dirtyChai)

const series = require('async/series')
const parallel = require('async/parallel')
const waterfall = require('async/waterfall')
Expand All @@ -20,7 +21,8 @@ const hat = require('hat')
const rmDir = promisify(rimraf)

const DaemonFactory = require('ipfsd-ctl')
const df = DaemonFactory.create()
const goDf = DaemonFactory.create()
const jsDf = DaemonFactory.create({ type: 'js' })

function tmpDir () {
return join(os.tmpdir(), `ipfs_${hat()}`)
Expand Down Expand Up @@ -57,9 +59,9 @@ describe('exchange files', () => {
this.timeout(50 * 1000)

parallel([
(cb) => df.spawn({ initOptions: { bits: 1024 } }, cb),
(cb) => df.spawn({ type: 'js', initOptions: { bits: 512 } }, cb),
(cb) => df.spawn({ type: 'js', initOptions: { bits: 512 } }, cb)
(cb) => goDf.spawn({ initOptions: { bits: 1024 } }, cb),
(cb) => jsDf.spawn({ initOptions: { bits: 512 } }, cb),
(cb) => jsDf.spawn({ initOptions: { bits: 512 } }, cb)
], (err, n) => {
expect(err).to.not.exist()
nodes = n
Expand Down
12 changes: 7 additions & 5 deletions test/kad-dht.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ const chai = require('chai')
const dirtyChai = require('dirty-chai')
const expect = chai.expect
chai.use(dirtyChai)

const series = require('async/series')
const crypto = require('crypto')
const parallel = require('async/parallel')
const waterfall = require('async/waterfall')
const bl = require('bl')

const DaemonFactory = require('ipfsd-ctl')
const df = DaemonFactory.create()
const goDf = DaemonFactory.create()
const jsDf = DaemonFactory.create({ type: 'js' })

describe.skip('kad-dht', () => {
describe('a JS node in the land of Go', () => {
Expand All @@ -23,10 +25,10 @@ describe.skip('kad-dht', () => {

before((done) => {
parallel([
(cb) => df.spawn({ initOptions: { bits: 1024 } }, cb),
(cb) => df.spawn({ initOptions: { bits: 1024 } }, cb),
(cb) => df.spawn({ initOptions: { bits: 1024 } }, cb),
(cb) => df.spawn({ type: 'js', initOptions: { bits: 512 } }, cb)
(cb) => goDf.spawn({ initOptions: { bits: 1024 } }, cb),
(cb) => goDf.spawn({ initOptions: { bits: 1024 } }, cb),
(cb) => goDf.spawn({ initOptions: { bits: 1024 } }, cb),
(cb) => jsDf.spawn({ initOptions: { bits: 512 } }, cb)
], (err, nodes) => {
expect(err).to.not.exist()
goD1 = nodes[0]
Expand Down
13 changes: 6 additions & 7 deletions test/repo.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ const path = require('path')
const hat = require('hat')

const DaemonFactory = require('ipfsd-ctl')
const df = DaemonFactory.create()
const goDf = DaemonFactory.create()
const jsDf = DaemonFactory.create({ type: 'js' })

function catAndCheck (api, hash, data, callback) {
api.cat(hash, (err, fileData) => {
Expand All @@ -35,7 +36,7 @@ describe('repo', () => {

let hash
series([
(cb) => df.spawn({
(cb) => goDf.spawn({
repoPath: dir,
disposable: false,
initOptions: { bits: 1024 }
Expand All @@ -52,8 +53,7 @@ describe('repo', () => {
}),
(cb) => catAndCheck(goDaemon.api, hash, data, cb),
(cb) => goDaemon.stop(cb),
(cb) => df.spawn({
type: 'js',
(cb) => jsDf.spawn({
repoPath: dir,
disposable: false,
initOptions: { bits: 512 }
Expand Down Expand Up @@ -82,8 +82,7 @@ describe('repo', () => {

let hash
series([
(cb) => df.spawn({
type: 'js',
(cb) => jsDf.spawn({
repoPath: dir,
initOptions: { bits: 512 }
}, cb),
Expand All @@ -97,7 +96,7 @@ describe('repo', () => {
catAndCheck(jsDaemon.api, hash, data, cb)
},
(cb) => jsDaemon.stop(cb),
(cb) => df.spawn({
(cb) => goDf.spawn({
repoPath: dir,
initOptions: { bits: 1024 }
}, cb),
Expand Down

0 comments on commit 2fbde7b

Please sign in to comment.