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

Commit

Permalink
fix: code review
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos committed Oct 17, 2018
1 parent c374b7f commit 664da27
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions test/ipns.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const expect = chai.expect
chai.use(dirtyChai)

const series = require('async/series')
const parallel = require('async/parallel')
const os = require('os')
const path = require('path')
const hat = require('hat')
Expand All @@ -19,7 +18,8 @@ const spawnJsDaemon = (dir, callback) => {
.spawn({
repoPath: dir,
disposable: false,
initOptions: { bits: 512 }
initOptions: { bits: 512 },
args: ['--offline']
}, callback)
}

Expand All @@ -46,9 +46,6 @@ const publishAndResolve = (publisherDaemon, resolverDaemon, callback) => {
}

const stopPublisherAndStartResolverDaemon = (callback) => {
if (sameDaemon) {
return callback()
}
series([
(cb) => publisherDaemon.stop(cb),
(cb) => setTimeout(cb, 2000),
Expand All @@ -65,7 +62,7 @@ const publishAndResolve = (publisherDaemon, resolverDaemon, callback) => {
cb()
}),
(cb) => publisherDaemon.api.name.publish(ipfsRef, { resolve: false }, cb),
(cb) => stopPublisherAndStartResolverDaemon(cb),
(cb) => sameDaemon ? cb() : stopPublisherAndStartResolverDaemon(cb),
(cb) => {
resolverDaemon.api.name.resolve(nodeId, { local: true }, (err, res) => {
expect(err).to.not.exist()
Expand All @@ -79,7 +76,7 @@ const publishAndResolve = (publisherDaemon, resolverDaemon, callback) => {
], callback)
}

describe('ipns', () => {
describe.only('ipns locally using the same repo across implementations', () => {
it('should publish an ipns record to a js daemon and resolve it using the same js daemon', function (done) {
this.timeout(120 * 1000)
const dir = path.join(os.tmpdir(), hat())
Expand All @@ -104,7 +101,7 @@ describe('ipns', () => {
this.timeout(120 * 1000)
const dir = path.join(os.tmpdir(), hat())

parallel([
series([
(cb) => spawnJsDaemon(dir, cb),
(cb) => spawnGoDaemon(dir, cb)
], (err, daemons) => {
Expand All @@ -118,7 +115,7 @@ describe('ipns', () => {
this.timeout(160 * 1000)
const dir = path.join(os.tmpdir(), hat())

parallel([
series([
(cb) => spawnGoDaemon(dir, cb),
(cb) => spawnJsDaemon(dir, cb)
], (err, daemons) => {
Expand Down

0 comments on commit 664da27

Please sign in to comment.