From 459a47379ece19abbce1a33e8da553ea9a87540d Mon Sep 17 00:00:00 2001 From: Richard Schneider Date: Thu, 15 Feb 2018 19:29:14 +1300 Subject: [PATCH] test(http-api/interface): use bootstrap test --- test/http-api/interface/bootstrap.js | 31 ++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 test/http-api/interface/bootstrap.js diff --git a/test/http-api/interface/bootstrap.js b/test/http-api/interface/bootstrap.js new file mode 100644 index 0000000000..3f3df9b0d3 --- /dev/null +++ b/test/http-api/interface/bootstrap.js @@ -0,0 +1,31 @@ +/* eslint-env mocha */ +'use strict' + +const test = require('interface-ipfs-core') +const parallel = require('async/parallel') + +const DaemonFactory = require('ipfsd-ctl') +const df = DaemonFactory.create({ exec: 'src/cli/bin.js' }) + +const nodes = [] +const common = { + setup: function (callback) { + callback(null, { + spawnNode: (cb) => { + df.spawn((err, _ipfsd) => { + if (err) { + return cb(err) + } + + nodes.push(_ipfsd) + cb(null, _ipfsd.api) + }) + } + }) + }, + teardown: function (callback) { + parallel(nodes.map((node) => (cb) => node.stop(cb)), callback) + } +} + +test.bootstrap(common)