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

fix: use new ipfsd-ctl setup #1127

Merged
merged 7 commits into from
Dec 11, 2019
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@
"cross-env": "^6.0.0",
"detect-node": "^2.0.4",
"go-ipfs-dep": "^0.4.22",
"interface-ipfs-core": "^0.124.0",
"ipfsd-ctl": "^0.47.1",
"interface-ipfs-core": "github:ipfs/interface-js-ipfs-core#feat/interface-tests",
"ipfsd-ctl": "github:ipfs/js-ipfsd-ctl#feat/interface-tests",
"ndjson": "^1.5.0",
"nock": "^11.4.0",
"pull-stream": "^3.6.14",
Expand Down
16 changes: 2 additions & 14 deletions test/commands.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,18 @@
'use strict'

const { expect } = require('interface-ipfs-core/src/utils/mocha')
const ipfsClient = require('../src')
const f = require('./utils/factory')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer for this to have a better name, but can be done another time.


describe('.commands', function () {
this.timeout(60 * 1000)

let ipfsd
let ipfs

before(async () => {
ipfsd = await f.spawn({
initOptions: {
bits: 1024,
profile: 'test'
}
})
ipfs = ipfsClient(ipfsd.apiAddr)
ipfs = (await f.spawn()).api
})

after(async () => {
if (ipfsd) {
await ipfsd.stop()
}
})
after(() => f.clean())

it('lists commands', async () => {
const res = await ipfs.commands()
Expand Down
12 changes: 3 additions & 9 deletions test/constructor.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,24 +93,18 @@ describe('ipfs-http-client constructor tests', () => {
})

describe('integration', () => {
let apiAddr
let ipfsd

before(async function () {
this.timeout(60 * 1000) // slow CI

ipfsd = await f.spawn({ initOptions: { bits: 1024, profile: 'test' } })
apiAddr = ipfsd.apiAddr.toString()
ipfsd = await f.spawn()
})

after(async () => {
if (ipfsd) {
await ipfsd.stop()
}
})
after(() => f.clean())

it('can connect to an ipfs http api', async () => {
await clientWorks(ipfsClient(apiAddr))
await clientWorks(ipfsClient(ipfsd.apiAddr))
})
})
})
Expand Down
16 changes: 2 additions & 14 deletions test/dag.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,17 @@
const { expect } = require('interface-ipfs-core/src/utils/mocha')
const { DAGNode } = require('ipld-dag-pb')
const CID = require('cids')
const ipfsClient = require('../src')
const f = require('./utils/factory')

let ipfsd
let ipfs

describe('.dag', function () {
this.timeout(20 * 1000)
before(async function () {
ipfsd = await f.spawn({
initOptions: {
bits: 1024,
profile: 'test'
}
})
ipfs = ipfsClient(ipfsd.apiAddr)
ipfs = (await f.spawn()).api
})

after(async () => {
if (ipfsd) {
await ipfsd.stop()
}
})
after(() => f.clean())

it('should be able to put and get a DAG node with format dag-pb', async () => {
const data = Buffer.from('some data')
Expand Down
16 changes: 2 additions & 14 deletions test/diag.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

const { expect } = require('interface-ipfs-core/src/utils/mocha')
const platform = require('browser-process-platform')
const ipfsClient = require('../src')
const f = require('./utils/factory')

describe('.diag', function () {
Expand All @@ -12,24 +11,13 @@ describe('.diag', function () {
// go-ipfs does not support these on Windows
if (platform === 'win32') { return }

let ipfsd
let ipfs

before(async () => {
ipfsd = await f.spawn({
initOptions: {
bits: 1024,
profile: 'test'
}
})
ipfs = ipfsClient(ipfsd.apiAddr)
ipfs = (await f.spawn()).api
})

after(async () => {
if (ipfsd) {
await ipfsd.stop()
}
})
after(() => f.clean())

describe('api API', () => {
// Disabled in go-ipfs 0.4.10
Expand Down
16 changes: 2 additions & 14 deletions test/files-mfs.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const values = require('pull-stream/sources/values')
const pull = require('pull-stream/pull')
const collect = require('pull-stream/sinks/collect')

const ipfsClient = require('../src')
const f = require('./utils/factory')
const expectTimeout = require('./utils/expect-timeout')

Expand All @@ -31,26 +30,15 @@ const HASH_ALGS = [
describe('.files (the MFS API part)', function () {
this.timeout(20 * 1000)

let ipfsd
let ipfs

const expectedMultihash = 'Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP'

before(async () => {
ipfsd = await f.spawn({
initOptions: {
bits: 1024,
profile: 'test'
}
})
ipfs = ipfsClient(ipfsd.apiAddr)
ipfs = (await f.spawn()).api
})

after(async () => {
if (ipfsd) {
await ipfsd.stop()
}
})
after(() => f.clean())

it('.add file for testing', async () => {
const res = await ipfs.add(testfile)
Expand Down
17 changes: 2 additions & 15 deletions test/get.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
const { expect } = require('interface-ipfs-core/src/utils/mocha')
const loadFixture = require('aegir/fixtures')

const ipfsClient = require('../src')
const f = require('./utils/factory')

describe('.get (specific go-ipfs features)', function () {
Expand All @@ -21,26 +20,14 @@ describe('.get (specific go-ipfs features)', function () {
data: fixture('test/fixtures/testfile.txt')
}

let ipfsd
let ipfs

before(async () => {
ipfsd = await f.spawn({
initOptions: {
bits: 1024,
profile: 'test'
}
})
ipfs = ipfsClient(ipfsd.apiAddr)

ipfs = (await f.spawn()).api
await ipfs.add(smallFile.data)
})

after(async () => {
if (ipfsd) {
await ipfsd.stop()
}
})
after(() => f.clean())

it('no compression args', async () => {
const files = await ipfs.get(smallFile.cid)
Expand Down
Loading