Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
feat(factory): add ipfs factory to files
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed Aug 11, 2016
1 parent 3db096e commit eba0398
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"form-data": "^1.0.0-rc4",
"gulp": "^3.9.1",
"idb-plus-blob-store": "^1.1.2",
"interface-ipfs-core": "^0.6.0",
"interface-ipfs-core": "^0.7.0",
"left-pad": "^1.1.1",
"lodash": "^4.14.1",
"ncp": "^2.0.0",
Expand Down Expand Up @@ -121,4 +121,4 @@
"kumavis <kumavis@users.noreply.github.com>",
"nginnever <ginneversource@gmail.com>"
]
}
}
14 changes: 5 additions & 9 deletions test/core/both/test-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,17 @@
'use strict'

const test = require('interface-ipfs-core')
const IPFS = require('../../../src/core')
const IPFSFactory = require('../../utils/factory')

// let factory
let factory

const common = {
setup: function (cb) {
// TODO change to factory
const ipfs = new IPFS(require('../../utils/repo-path'))
ipfs.load(() => {
cb(null, ipfs)
})
factory = new IPFSFactory()
cb(null, factory)
},
teardown: function (cb) {
// factory.teardown
cb()
factory.dismantle(cb)
}
}

Expand Down
8 changes: 3 additions & 5 deletions test/utils/factory/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
'use strict'

const fs = require('fs')
const path = require('path')
const PeerId = require('peer-id')
const isNode = require('detect-node')
const IPFSRepo = require('ipfs-repo')
const cleanRepo = require('../clean')
const IPFS = require('../../../src/core')
const series = require('run-series')
const defaultConfig = require('./default-config.json')

module.exports = Factory

Expand Down Expand Up @@ -36,9 +35,8 @@ function Factory () {
}

if (!config) {
const defaultConfigPath = path.join(__dirname, 'default-config.json')
config = JSON.parse(fs.readFileSync(defaultConfigPath).toString())
const pId = PeerId.create().toJSON()
config = JSON.parse(JSON.stringify(defaultConfig))
const pId = PeerId.create({ bits: 32 }).toJSON()
config.Identity.PeerID = pId.id
config.Identity.PrivKey = pId.privKey
}
Expand Down

0 comments on commit eba0398

Please sign in to comment.