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

Commit

Permalink
fix: update to the latest ctl api
Browse files Browse the repository at this point in the history
  • Loading branch information
hugomrdias committed Dec 10, 2019
1 parent 12bbf34 commit b502af9
Show file tree
Hide file tree
Showing 13 changed files with 38 additions and 32 deletions.
4 changes: 2 additions & 2 deletions test/commands.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ describe('.commands', function () {
let ipfs

before(async () => {
ipfs = await f.setup()
ipfs = (await f.spawn()).api
})

after(() => f.teardown())
after(() => f.clean())

it('lists commands', async () => {
const res = await ipfs.commands()
Expand Down
4 changes: 2 additions & 2 deletions test/constructor.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ describe('ipfs-http-client constructor tests', () => {
before(async function () {
this.timeout(60 * 1000) // slow CI

ipfsd = await f.node()
ipfsd = await f.spawn()
})

after(() => ipfsd.stop())
after(() => f.clean())

it('can connect to an ipfs http api', async () => {
await clientWorks(ipfsClient(ipfsd.apiAddr))
Expand Down
4 changes: 2 additions & 2 deletions test/dag.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ let ipfs
describe('.dag', function () {
this.timeout(20 * 1000)
before(async function () {
ipfs = await f.setup()
ipfs = (await f.spawn()).api
})

after(() => f.teardown())
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
4 changes: 2 additions & 2 deletions test/diag.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ describe('.diag', function () {
let ipfs

before(async () => {
ipfs = await f.setup()
ipfs = (await f.spawn()).api
})

after(() => f.teardown())
after(() => f.clean())

describe('api API', () => {
// Disabled in go-ipfs 0.4.10
Expand Down
4 changes: 2 additions & 2 deletions test/files-mfs.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ describe('.files (the MFS API part)', function () {
const expectedMultihash = 'Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP'

before(async () => {
ipfs = await f.setup()
ipfs = (await f.spawn()).api
})

after(() => f.teardown())
after(() => f.clean())

it('.add file for testing', async () => {
const res = await ipfs.add(testfile)
Expand Down
4 changes: 2 additions & 2 deletions test/get.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ describe('.get (specific go-ipfs features)', function () {
let ipfs

before(async () => {
ipfs = await f.setup()
ipfs = (await f.spawn()).api
await ipfs.add(smallFile.data)
})

after(() => f.teardown())
after(() => f.clean())

it('no compression args', async () => {
const files = await ipfs.get(smallFile.cid)
Expand Down
18 changes: 12 additions & 6 deletions test/interface.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,26 @@
const tests = require('interface-ipfs-core')
const merge = require('merge-options')
const { isNode } = require('ipfs-utils/src/env')
const { createTestsInterface } = require('ipfsd-ctl')
const { createFactory } = require('ipfsd-ctl')
const { findBin } = require('ipfsd-ctl/src/utils')
const isWindows = process.platform && process.platform === 'win32'

/** @typedef {import("ipfsd-ctl").ControllerOptions} ControllerOptions */

describe('interface-ipfs-core tests', () => {
/** @type ControllerOptions */
const commonOptions = {
test: true,
ipfsHttp: {
path: require.resolve('../src'),
ref: require('../src')
},
ipfsOptions: {
pass: 'ipfs-is-awesome-software'
}
},
ipfsBin: findBin('go')
}
const commonFactory = createTestsInterface(commonOptions)
const commonFactory = createFactory(commonOptions)

tests.bitswap(commonFactory)

Expand Down Expand Up @@ -152,7 +158,7 @@ describe('interface-ipfs-core tests', () => {

tests.miscellaneous(commonFactory)

tests.name(createTestsInterface(merge(commonOptions,
tests.name(createFactory(merge(commonOptions,
{
ipfsOptions: {
offline: true
Expand All @@ -168,7 +174,7 @@ describe('interface-ipfs-core tests', () => {
]
})

tests.namePubsub(createTestsInterface(merge(commonOptions,
tests.namePubsub(createFactory(merge(commonOptions,
{
ipfsOptions: {
EXPERIMENTAL: {
Expand Down Expand Up @@ -212,7 +218,7 @@ describe('interface-ipfs-core tests', () => {
]
})

tests.pubsub(createTestsInterface(merge(commonOptions,
tests.pubsub(createFactory(merge(commonOptions,
{
args: ['--enable-pubsub-experiment']
}
Expand Down
5 changes: 2 additions & 3 deletions test/key.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-env mocha */
/* eslint max-nested-callbacks: ["error", 8] */
'use strict'

const { expect } = require('interface-ipfs-core/src/utils/mocha')
Expand All @@ -11,10 +10,10 @@ describe('.key', function () {
let ipfs

before(async () => {
ipfs = await f.setup()
ipfs = (await f.spawn()).api
})

after(() => f.teardown())
after(() => f.clean())

describe('.gen', () => {
it('create a new rsa key', async () => {
Expand Down
4 changes: 2 additions & 2 deletions test/log.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ describe('.log', function () {
let ipfs

before(async () => {
ipfs = await f.setup()
ipfs = (await f.spawn()).api
})

after(() => f.teardown())
after(() => f.clean())

it('.log.tail', async () => {
const i = setInterval(async () => {
Expand Down
6 changes: 3 additions & 3 deletions test/ping.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ describe('.ping', function () {
before(async function () {
this.timeout(30 * 1000) // slow CI

ipfs = await f.setup()
other = await f.setup()
ipfs = (await f.spawn()).api
other = (await f.spawn()).api

const ma = (await ipfs.id()).addresses[0]
await other.swarm.connect(ma)

otherId = (await other.id()).id
})

after(() => f.teardown())
after(() => f.clean())

it('.ping with default count', async () => {
const res = await ipfs.ping(otherId)
Expand Down
4 changes: 2 additions & 2 deletions test/repo.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ describe('.repo', function () {
let ipfs

before(async () => {
ipfs = await f.setup()
ipfs = (await f.spawn()).api
})

after(() => f.teardown())
after(() => f.clean())

it('.repo.gc', async () => {
const res = await ipfs.repo.gc()
Expand Down
4 changes: 2 additions & 2 deletions test/stats.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ describe('stats', function () {
let ipfs

before(async () => {
ipfs = await f.setup()
ipfs = (await f.spawn()).api
})

after(() => f.teardown())
after(() => f.clean())

it('.stats.bitswap', async () => {
const res = await ipfs.stats.bitswap()
Expand Down
5 changes: 3 additions & 2 deletions test/utils/factory.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
'use strict'
const { createTestsInterface } = require('ipfsd-ctl')
const { createFactory } = require('ipfsd-ctl')
const { findBin } = require('ipfsd-ctl/src/utils')

const factory = createTestsInterface({
const factory = createFactory({
test: 'true',
type: 'go',
ipfsBin: findBin('go'),
ipfsHttp: {
Expand Down

0 comments on commit b502af9

Please sign in to comment.