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

Commit 2fbde7b

Browse files
dryajovdaviddias
authored andcommitted
fix: daemon type in tests (#18)
* fix: daemon type in tests * fix: dont specify type twise
1 parent 9241cc7 commit 2fbde7b

File tree

3 files changed

+19
-16
lines changed

3 files changed

+19
-16
lines changed

test/exchange-files.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const chai = require('chai')
55
const dirtyChai = require('dirty-chai')
66
const expect = chai.expect
77
chai.use(dirtyChai)
8+
89
const series = require('async/series')
910
const parallel = require('async/parallel')
1011
const waterfall = require('async/waterfall')
@@ -20,7 +21,8 @@ const hat = require('hat')
2021
const rmDir = promisify(rimraf)
2122

2223
const DaemonFactory = require('ipfsd-ctl')
23-
const df = DaemonFactory.create()
24+
const goDf = DaemonFactory.create()
25+
const jsDf = DaemonFactory.create({ type: 'js' })
2426

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

5961
parallel([
60-
(cb) => df.spawn({ initOptions: { bits: 1024 } }, cb),
61-
(cb) => df.spawn({ type: 'js', initOptions: { bits: 512 } }, cb),
62-
(cb) => df.spawn({ type: 'js', initOptions: { bits: 512 } }, cb)
62+
(cb) => goDf.spawn({ initOptions: { bits: 1024 } }, cb),
63+
(cb) => jsDf.spawn({ initOptions: { bits: 512 } }, cb),
64+
(cb) => jsDf.spawn({ initOptions: { bits: 512 } }, cb)
6365
], (err, n) => {
6466
expect(err).to.not.exist()
6567
nodes = n

test/kad-dht.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@ const chai = require('chai')
55
const dirtyChai = require('dirty-chai')
66
const expect = chai.expect
77
chai.use(dirtyChai)
8+
89
const series = require('async/series')
910
const crypto = require('crypto')
1011
const parallel = require('async/parallel')
1112
const waterfall = require('async/waterfall')
1213
const bl = require('bl')
1314

1415
const DaemonFactory = require('ipfsd-ctl')
15-
const df = DaemonFactory.create()
16+
const goDf = DaemonFactory.create()
17+
const jsDf = DaemonFactory.create({ type: 'js' })
1618

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

2426
before((done) => {
2527
parallel([
26-
(cb) => df.spawn({ initOptions: { bits: 1024 } }, cb),
27-
(cb) => df.spawn({ initOptions: { bits: 1024 } }, cb),
28-
(cb) => df.spawn({ initOptions: { bits: 1024 } }, cb),
29-
(cb) => df.spawn({ type: 'js', initOptions: { bits: 512 } }, cb)
28+
(cb) => goDf.spawn({ initOptions: { bits: 1024 } }, cb),
29+
(cb) => goDf.spawn({ initOptions: { bits: 1024 } }, cb),
30+
(cb) => goDf.spawn({ initOptions: { bits: 1024 } }, cb),
31+
(cb) => jsDf.spawn({ initOptions: { bits: 512 } }, cb)
3032
], (err, nodes) => {
3133
expect(err).to.not.exist()
3234
goD1 = nodes[0]

test/repo.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ const path = require('path')
1313
const hat = require('hat')
1414

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

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

3637
let hash
3738
series([
38-
(cb) => df.spawn({
39+
(cb) => goDf.spawn({
3940
repoPath: dir,
4041
disposable: false,
4142
initOptions: { bits: 1024 }
@@ -52,8 +53,7 @@ describe('repo', () => {
5253
}),
5354
(cb) => catAndCheck(goDaemon.api, hash, data, cb),
5455
(cb) => goDaemon.stop(cb),
55-
(cb) => df.spawn({
56-
type: 'js',
56+
(cb) => jsDf.spawn({
5757
repoPath: dir,
5858
disposable: false,
5959
initOptions: { bits: 512 }
@@ -82,8 +82,7 @@ describe('repo', () => {
8282

8383
let hash
8484
series([
85-
(cb) => df.spawn({
86-
type: 'js',
85+
(cb) => jsDf.spawn({
8786
repoPath: dir,
8887
initOptions: { bits: 512 }
8988
}, cb),
@@ -97,7 +96,7 @@ describe('repo', () => {
9796
catAndCheck(jsDaemon.api, hash, data, cb)
9897
},
9998
(cb) => jsDaemon.stop(cb),
100-
(cb) => df.spawn({
99+
(cb) => goDf.spawn({
101100
repoPath: dir,
102101
initOptions: { bits: 1024 }
103102
}, cb),

0 commit comments

Comments
 (0)