This repository was archived by the owner on Mar 10, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 297
/
Copy pathinterface.spec.js
315 lines (290 loc) · 9.75 KB
/
interface.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
/* eslint-env mocha */
'use strict'
const tests = require('interface-ipfs-core')
const isNode = require('detect-node')
const CommonFactory = require('./utils/interface-common-factory')
const ipfsClient = require('../src')
const isWindows = process.platform && process.platform === 'win32'
describe('interface-ipfs-core tests', () => {
const defaultCommonFactory = CommonFactory.create()
tests.bitswap(defaultCommonFactory, {
skip: [
// bitswap.stat
{
name: 'should not get bitswap stats when offline',
reason: 'FIXME go-ipfs returns an error https://github.com/ipfs/go-ipfs/issues/4078'
},
// bitswap.wantlist
{
name: 'should not get the wantlist when offline',
reason: 'FIXME go-ipfs returns an error https://github.com/ipfs/go-ipfs/issues/4078'
},
// bitswap.unwant
{
name: 'should remove a key from the wantlist',
reason: 'FIXME why is this skipped?'
},
{
name: 'should not remove a key from the wantlist when offline',
reason: 'FIXME go-ipfs returns an error https://github.com/ipfs/go-ipfs/issues/4078'
}
]
})
tests.block(defaultCommonFactory, {
skip: [{
name: 'should get a block added as CIDv1 with a CIDv0',
reason: 'go-ipfs does not support the `version` param'
}]
})
tests.bootstrap(defaultCommonFactory)
tests.config(defaultCommonFactory, {
skip: [
// config.replace
{
name: 'replace',
reason: 'FIXME Waiting for fix on go-ipfs https://github.com/ipfs/js-ipfs-http-client/pull/307#discussion_r69281789 and https://github.com/ipfs/go-ipfs/issues/2927'
}
]
})
tests.dag(defaultCommonFactory, {
skip: [
// dag.tree
{
name: 'tree',
reason: 'TODO vmx 2018-02-22: Currently the tree API is not exposed in go-ipfs'
},
// dag.get:
{
name: 'should get a dag-pb node local value',
reason: 'FIXME vmx 2018-02-22: Currently not supported in go-ipfs, it might be possible once https://github.com/ipfs/go-ipfs/issues/4728 is done'
},
{
name: 'should get dag-pb value via dag-cbor node',
reason: 'FIXME vmx 2018-02-22: Currently not supported in go-ipfs, it might be possible once https://github.com/ipfs/go-ipfs/issues/4728 is done'
},
{
name: 'should get by CID string + path',
reason: 'FIXME vmx 2018-02-22: Currently not supported in go-ipfs, it might be possible once https://github.com/ipfs/go-ipfs/issues/4728 is done'
},
{
name: 'should get only a CID, due to resolving locally only',
reason: 'FIXME: go-ipfs does not support localResolve option'
}
]
})
tests.dht(defaultCommonFactory, {
skip: [
// dht.findpeer
{
name: 'should fail to find other peer if peer does not exist',
reason: 'FIXME checking what is exactly go-ipfs returning https://github.com/ipfs/go-ipfs/issues/3862#issuecomment-294168090'
},
// dht.findprovs
{
name: 'should provide from one node and find it through another node',
reason: 'FIXME go-ipfs endpoint doesn\'t conform with the others https://github.com/ipfs/go-ipfs/issues/5047'
},
// dht.get
{
name: 'should get a value after it was put on another node',
reason: 'FIXME go-ipfs errors with Error: key was not found (type 6) https://github.com/ipfs/go-ipfs/issues/3862'
}
]
})
tests.filesRegular(defaultCommonFactory, {
skip: [
// .add
isNode ? null : {
name: 'should add a nested directory as array of tupples',
reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339'
},
isNode ? null : {
name: 'should add a nested directory as array of tupples with progress',
reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339'
},
// .addPullStream
isNode ? null : {
name: 'should add pull stream of valid files and dirs',
reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339'
},
// .addReadableStream
isNode ? null : {
name: 'should add readable stream of valid files and dirs',
reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339'
},
// .addFromStream
isNode ? null : {
name: 'addFromStream',
reason: 'Not designed to run in the browser'
},
// .addFromFs
isNode ? null : {
name: 'addFromFs',
reason: 'Not designed to run in the browser'
},
// .addFromURL
isNode ? null : {
name: 'addFromURL',
reason: 'Not designed to run in the browser'
},
// TODO: remove when interface-ipfs-core updated
isNode ? null : {
name: 'addFromUrl',
reason: 'Not designed to run in the browser'
},
// .catPullStream
{
name: 'should export a chunk of a file',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should export a chunk of a file in a Pull Stream',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should export a chunk of a file in a Readable Stream',
reason: 'TODO not implemented in go-ipfs yet'
},
// .get
isNode ? null : {
name: 'should get a directory',
reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339'
},
// .ls
isNode ? null : {
name: 'should ls with a base58 encoded CID',
reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339'
},
// .lsPullStream
isNode ? null : {
name: 'should pull stream ls with a base58 encoded CID',
reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339'
},
// .lsReadableStream
isNode ? null : {
name: 'should readable stream ls with a base58 encoded CID',
reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339'
},
// .refs
{
name: 'dag refs test',
reason: 'FIXME unskip when 0.4.21 is released'
}
]
})
tests.filesMFS(defaultCommonFactory)
tests.key(defaultCommonFactory, {
skip: [
// key.export
{
name: 'export',
reason: 'TODO not implemented in go-ipfs yet'
},
// key.import
{
name: 'import',
reason: 'TODO not implemented in go-ipfs yet'
}
]
})
tests.miscellaneous(defaultCommonFactory, {
skip: [
// stop
{
name: 'should stop the node',
reason: 'FIXME go-ipfs returns an error https://github.com/ipfs/go-ipfs/issues/4078'
}
]
})
tests.name(CommonFactory.create({
spawnOptions: {
args: ['--offline']
}
}))
// TODO: uncomment after https://github.com/ipfs/interface-ipfs-core/pull/361 being merged and a new release
tests.namePubsub(CommonFactory.create({
spawnOptions: {
args: ['--enable-namesys-pubsub'],
initOptions: { bits: 1024 }
}
}), {
skip: [
// name.pubsub.cancel
{
name: 'should cancel a subscription correctly returning true',
reason: 'go-ipfs is really slow for publishing and resolving ipns records, unless in offline mode'
},
// name.pubsub.subs
{
name: 'should get the list of subscriptions updated after a resolve',
reason: 'go-ipfs is really slow for publishing and resolving ipns records, unless in offline mode'
}
]
})
tests.object(defaultCommonFactory)
tests.pin(defaultCommonFactory)
tests.ping(defaultCommonFactory, {
skip: [
{
name: 'should fail when pinging an unknown peer over pull stream',
reason: 'FIXME go-ipfs return success with text: Looking up peer <cid>'
},
{
name: 'should fail when pinging peer that is not available over readable stream',
reason: 'FIXME go-ipfs return success with text: Looking up peer <cid>'
},
{
name: 'should fail when pinging a peer that is not available',
reason: 'FIXME go-ipfs return success with text: Looking up peer <cid>'
}
]
})
tests.pubsub(CommonFactory.create({
spawnOptions: {
args: ['--enable-pubsub-experiment'],
initOptions: { bits: 1024 }
}
}), {
skip: isNode ? [
// pubsub.subscribe
isWindows ? {
name: 'should send/receive 100 messages',
reason: 'FIXME https://github.com/ipfs/interface-ipfs-core/pull/188#issuecomment-354673246 and https://github.com/ipfs/go-ipfs/issues/4778'
} : null,
isWindows ? {
name: 'should receive multiple messages',
reason: 'FIXME https://github.com/ipfs/interface-ipfs-core/pull/188#issuecomment-354673246 and https://github.com/ipfs/go-ipfs/issues/4778'
} : null
] : {
reason: 'FIXME pubsub is not supported in the browser https://github.com/ipfs/js-ipfs-http-client/issues/518'
}
})
tests.repo(defaultCommonFactory)
tests.stats(defaultCommonFactory)
tests.swarm(CommonFactory.create({
createSetup ({ ipfsFactory, nodes }) {
return callback => {
callback(null, {
spawnNode (repoPath, config, cb) {
if (typeof repoPath === 'function') {
cb = repoPath
repoPath = undefined
}
if (typeof config === 'function') {
cb = config
config = undefined
}
const spawnOptions = { repoPath, config, initOptions: { bits: 1024, profile: 'test' } }
ipfsFactory.spawn(spawnOptions, (err, _ipfsd) => {
if (err) {
return cb(err)
}
nodes.push(_ipfsd)
cb(null, ipfsClient(_ipfsd.apiAddr))
})
}
})
}
}
}))
})