Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Commit

Permalink
feat(factory): use the factory mode
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed Aug 10, 2016
1 parent 6948370 commit 5021223
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 14 deletions.
16 changes: 15 additions & 1 deletion test/api/files.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,21 @@ testfile = require('fs').readFileSync(path.join(__dirname, '/../testfile.txt'))
// Load the add/cat/get/ls commands from interface-ipfs-core
const common = {
setup: function (cb) {
cb(null, apiClients.a)
let c = 0
cb(null, {
spawnNode: (path, config, callback) => {
if (typeof path === 'function') {
callback = path
path = undefined
}
switch (c) {
case 0: callback(null, apiClients.a); c++; break
case 1: callback(null, apiClients.b); c++; break
case 2: callback(null, apiClients.c); c++; break
default: callback(new Error('no more nodes available'))
}
}
})
},
teardown: function (cb) {
cb()
Expand Down
12 changes: 11 additions & 1 deletion test/api/object.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,17 @@ const test = require('interface-ipfs-core')

const common = {
setup: function (cb) {
cb(null, apiClients.a)
let c = 0
cb(null, {
spawnNode: (path, config, callback) => {
switch (c) {
case 0: callback(null, apiClients.a); c++; break
case 1: callback(null, apiClients.b); c++; break
case 2: callback(null, apiClients.c); c++; break
default: callback(new Error('no more nodes available'))
}
}
})
},
teardown: function (cb) {
cb()
Expand Down
12 changes: 0 additions & 12 deletions test/notes.org

This file was deleted.

0 comments on commit 5021223

Please sign in to comment.