From 108414bfc4a84757ce7a257b733fe9f7df0724de Mon Sep 17 00:00:00 2001 From: David Dias Date: Thu, 30 Jun 2016 14:12:34 +0100 Subject: [PATCH] refactor(module+tests): Enable running the tests individually and reduce complexity inside ipfs-api --- README.md | 7 ++----- package.json | 4 ++-- test/interface-ipfs-core/config.spec.js | 13 ++++++++----- test/tmp-disposable-nodes-addrs.json | 1 + 4 files changed, 13 insertions(+), 12 deletions(-) create mode 100644 test/tmp-disposable-nodes-addrs.json diff --git a/README.md b/README.md index 32d018ac7..4cb6a9dcd 100644 --- a/README.md +++ b/README.md @@ -105,9 +105,7 @@ $ ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin "[\"http://exam ### API -> `WIP` - -`js-ipfs-api` follows the spec defined by [`interface-ipfs-core`](https://github.com/ipfs/interface-ipfs-core), which concerns the interface to expect from IPFS implementations. This interface is a currently active endeavor - expect it to be complete in the next few weeks (August 2016). You can use it today to consult the methods available. +> `js-ipfs-api` follows the spec defined by [`interface-ipfs-core`](https://github.com/ipfs/interface-ipfs-core), which concerns the interface to expect from IPFS implementations. This interface is a currently active endeavor - expect it to be complete in the next few weeks (August 2016). You can use it today to consult the methods available. ### Utility functions @@ -140,6 +138,7 @@ This is very similar to `ipfs.files.add({path:'', content: stream})`. It is like ```JavaScript ``` +>>>>>> refactor(module+tests): Enable running the tests ### Callbacks and promises @@ -166,8 +165,6 @@ We run tests by executing `npm test` in a terminal window. This will run both No ->>>>>>> kick off ipfs-api next generation - ## Contribute The js-ipfs-api is a work in progress. As such, there's a few things you can do right now to help out: diff --git a/package.json b/package.json index 2236b624f..d2e2b1ea8 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "ipfs-api", "version": "6.0.3", - "description": "A client library for the IPFS API", - "main": "src/index.js", + "description": "A client library for the IPFS HTTP API. Follows interface-ipfs-core spec", + "main": "lib/index.js", "jsnext:main": "src/index.js", "scripts": { "test": "gulp test", diff --git a/test/interface-ipfs-core/config.spec.js b/test/interface-ipfs-core/config.spec.js index 0d87e0363..794fd4678 100644 --- a/test/interface-ipfs-core/config.spec.js +++ b/test/interface-ipfs-core/config.spec.js @@ -1,16 +1,19 @@ /* eslint-env mocha */ /* eslint max-nested-callbacks: ["error", 8] */ -/* globals apiClients */ 'use strict' const test = require('interface-ipfs-core') +const FactoryClient = require('../factory/factory-client') + +let fc const common = { - setup: function (cb) { - cb(null, apiClients.a) + setup: function (callback) { + fc = new FactoryClient() + callback(null, fc) }, - teardown: function (cb) { - cb() + teardown: function (callback) { + fc.dismantle(callback) } } diff --git a/test/tmp-disposable-nodes-addrs.json b/test/tmp-disposable-nodes-addrs.json new file mode 100644 index 000000000..851a00021 --- /dev/null +++ b/test/tmp-disposable-nodes-addrs.json @@ -0,0 +1 @@ +{"c":"/ip4/127.0.0.1/tcp/56459","a":"/ip4/127.0.0.1/tcp/56466","b":"/ip4/127.0.0.1/tcp/56479"} \ No newline at end of file