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

Commit 23af1ff

Browse files
committed
fix: use new ipfsd-ctl setup
1 parent 191f414 commit 23af1ff

File tree

3 files changed

+56
-160
lines changed

3 files changed

+56
-160
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
"through2": "^3.0.1"
104104
},
105105
"devDependencies": {
106-
"aegir": "^20.3.1",
106+
"aegir": "^20.3.2",
107107
"browser-process-platform": "~0.1.1",
108108
"cross-env": "^6.0.0",
109109
"go-ipfs-dep": "^0.4.22",

test/interface.spec.js

Lines changed: 55 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,29 @@
22
'use strict'
33

44
const tests = require('interface-ipfs-core')
5-
const isNode = require('detect-node')
6-
const CommonFactory = require('./utils/interface-common-factory')
5+
const merge = require('merge-options')
6+
const { isNode } = require('ipfs-utils/src/env')
7+
const ctl = require('ipfsd-ctl')
78
const isWindows = process.platform && process.platform === 'win32'
89

910
describe('interface-ipfs-core tests', () => {
10-
const defaultCommonFactory = CommonFactory.create()
11+
const commonOptions = {
12+
factoryOptions: { IpfsClient: require('../src') }
13+
}
14+
const commonFactory = ctl.createTestsInterface(commonOptions)
1115

12-
tests.bitswap(defaultCommonFactory, {
13-
skip: [
14-
// bitswap.stat
15-
{
16-
name: 'should not get bitswap stats when offline',
17-
reason: 'FIXME go-ipfs returns an error https://github.com/ipfs/go-ipfs/issues/4078'
18-
},
19-
// bitswap.wantlist
20-
{
21-
name: 'should not get the wantlist when offline',
22-
reason: 'FIXME go-ipfs returns an error https://github.com/ipfs/go-ipfs/issues/4078'
23-
},
24-
// bitswap.unwant
25-
{
26-
name: 'should remove a key from the wantlist',
27-
reason: 'FIXME why is this skipped?'
28-
},
29-
{
30-
name: 'should not remove a key from the wantlist when offline',
31-
reason: 'FIXME go-ipfs returns an error https://github.com/ipfs/go-ipfs/issues/4078'
32-
}
33-
]
34-
})
16+
tests.bitswap(commonFactory)
3517

36-
tests.block(defaultCommonFactory, {
18+
tests.block(commonFactory, {
3719
skip: [{
3820
name: 'should get a block added as CIDv1 with a CIDv0',
3921
reason: 'go-ipfs does not support the `version` param'
4022
}]
4123
})
4224

43-
tests.bootstrap(defaultCommonFactory)
25+
tests.bootstrap(commonFactory)
4426

45-
tests.config(defaultCommonFactory, {
27+
tests.config(commonFactory, {
4628
skip: [
4729
// config.replace
4830
{
@@ -60,7 +42,7 @@ describe('interface-ipfs-core tests', () => {
6042
]
6143
})
6244

63-
tests.dag(defaultCommonFactory, {
45+
tests.dag(commonFactory, {
6446
skip: [
6547
// dag.tree
6648
{
@@ -87,7 +69,7 @@ describe('interface-ipfs-core tests', () => {
8769
]
8870
})
8971

90-
tests.dht(defaultCommonFactory, {
72+
tests.dht(commonFactory, {
9173
skip: [
9274
// dht.findpeer
9375
{
@@ -107,47 +89,47 @@ describe('interface-ipfs-core tests', () => {
10789
]
10890
})
10991

110-
tests.filesRegular(defaultCommonFactory, {
92+
tests.filesMFS(commonFactory, {
11193
skip: [
112-
// .addFromFs
113-
isNode ? null : {
114-
name: 'addFromFs',
115-
reason: 'Not designed to run in the browser'
116-
},
117-
// .catPullStream
11894
{
119-
name: 'should export a chunk of a file',
120-
reason: 'TODO not implemented in go-ipfs yet'
95+
name: 'should ls directory with long option',
96+
reason: 'TODO unskip when go-ipfs supports --long https://github.com/ipfs/go-ipfs/pull/6528'
12197
},
12298
{
123-
name: 'should export a chunk of a file in a Pull Stream',
99+
name: 'should read from outside of mfs',
124100
reason: 'TODO not implemented in go-ipfs yet'
125101
},
126102
{
127-
name: 'should export a chunk of a file in a Readable Stream',
103+
name: 'should ls from outside of mfs',
128104
reason: 'TODO not implemented in go-ipfs yet'
129105
}
130106
]
131107
})
132108

133-
tests.filesMFS(defaultCommonFactory, {
109+
tests.filesRegular(commonFactory, {
134110
skip: [
111+
// .addFromFs
112+
isNode ? null : {
113+
name: 'addFromFs',
114+
reason: 'Not designed to run in the browser'
115+
},
116+
// .catPullStream
135117
{
136-
name: 'should ls directory with long option',
137-
reason: 'TODO unskip when go-ipfs supports --long https://github.com/ipfs/go-ipfs/pull/6528'
118+
name: 'should export a chunk of a file',
119+
reason: 'TODO not implemented in go-ipfs yet'
138120
},
139121
{
140-
name: 'should read from outside of mfs',
122+
name: 'should export a chunk of a file in a Pull Stream',
141123
reason: 'TODO not implemented in go-ipfs yet'
142124
},
143125
{
144-
name: 'should ls from outside of mfs',
126+
name: 'should export a chunk of a file in a Readable Stream',
145127
reason: 'TODO not implemented in go-ipfs yet'
146128
}
147129
]
148130
})
149131

150-
tests.key(defaultCommonFactory, {
132+
tests.key(commonFactory, {
151133
skip: [
152134
// key.export
153135
{
@@ -162,7 +144,7 @@ describe('interface-ipfs-core tests', () => {
162144
]
163145
})
164146

165-
tests.miscellaneous(defaultCommonFactory, {
147+
tests.miscellaneous(commonFactory, {
166148
skip: [
167149
// stop
168150
{
@@ -172,19 +154,21 @@ describe('interface-ipfs-core tests', () => {
172154
]
173155
})
174156

175-
tests.name(CommonFactory.create({
176-
spawnOptions: {
177-
args: ['--offline']
157+
tests.name(ctl.createTestsInterface(merge(commonOptions,
158+
{
159+
spawnOptions: {
160+
args: ['--offline']
161+
}
178162
}
179-
}))
163+
)))
180164

181-
// TODO: uncomment after https://github.com/ipfs/interface-ipfs-core/pull/361 being merged and a new release
182-
tests.namePubsub(CommonFactory.create({
183-
spawnOptions: {
184-
args: ['--enable-namesys-pubsub'],
185-
initOptions: { bits: 1024, profile: 'test' }
165+
tests.namePubsub(ctl.createTestsInterface(merge(commonOptions,
166+
{
167+
spawnOptions: {
168+
args: ['--enable-namesys-pubsub']
169+
}
186170
}
187-
}), {
171+
)), {
188172
skip: [
189173
// name.pubsub.cancel
190174
{
@@ -199,11 +183,11 @@ describe('interface-ipfs-core tests', () => {
199183
]
200184
})
201185

202-
tests.object(defaultCommonFactory)
186+
tests.object(commonFactory)
203187

204-
tests.pin(defaultCommonFactory)
188+
tests.pin(commonFactory)
205189

206-
tests.ping(defaultCommonFactory, {
190+
tests.ping(commonFactory, {
207191
skip: [
208192
{
209193
name: 'should fail when pinging an unknown peer over pull stream',
@@ -220,12 +204,13 @@ describe('interface-ipfs-core tests', () => {
220204
]
221205
})
222206

223-
tests.pubsub(CommonFactory.create({
224-
spawnOptions: {
225-
args: ['--enable-pubsub-experiment'],
226-
initOptions: { bits: 1024, profile: 'test' }
207+
tests.pubsub(ctl.createTestsInterface(merge(commonOptions,
208+
{
209+
spawnOptions: {
210+
args: ['--enable-pubsub-experiment']
211+
}
227212
}
228-
}), {
213+
)), {
229214
skip: isWindows ? [
230215
// pubsub.subscribe
231216
{
@@ -239,9 +224,9 @@ describe('interface-ipfs-core tests', () => {
239224
] : null
240225
})
241226

242-
tests.repo(defaultCommonFactory)
227+
tests.repo(commonFactory)
243228

244-
tests.stats(defaultCommonFactory)
229+
tests.stats(commonFactory)
245230

246-
tests.swarm(CommonFactory.createAsync())
231+
tests.swarm(commonFactory)
247232
})

test/utils/interface-common-factory.js

Lines changed: 0 additions & 89 deletions
This file was deleted.

0 commit comments

Comments
 (0)