|
| 1 | +/* eslint-env mocha */ |
| 2 | +'use strict' |
| 3 | + |
| 4 | +const tests = require('interface-ipfs-core') |
| 5 | +const isNode = require('detect-node') |
| 6 | +const CommonFactory = require('./utils/interface-common-factory') |
| 7 | +const IPFSApi = require('../src') |
| 8 | +const isWindows = process.platform && process.platform === 'win32' |
| 9 | + |
| 10 | +describe('interface-ipfs-core tests', () => { |
| 11 | + const defaultCommonFactory = CommonFactory.create() |
| 12 | + |
| 13 | + tests.bitswap(defaultCommonFactory, { |
| 14 | + skip: [ |
| 15 | + // bitswap.stat |
| 16 | + { |
| 17 | + name: 'should not get bitswap stats when offline', |
| 18 | + reason: 'FIXME go-ipfs returns an error https://github.com/ipfs/go-ipfs/issues/4078' |
| 19 | + }, |
| 20 | + // bitswap.wantlist |
| 21 | + { |
| 22 | + name: 'should not get the wantlist when offline', |
| 23 | + reason: 'FIXME go-ipfs returns an error https://github.com/ipfs/go-ipfs/issues/4078' |
| 24 | + }, |
| 25 | + // bitswap.unwant |
| 26 | + { |
| 27 | + name: 'should remove a key from the wantlist', |
| 28 | + reason: 'FIXME why is this skipped?' |
| 29 | + }, |
| 30 | + { |
| 31 | + name: 'should not remove a key from the wantlist when offline', |
| 32 | + reason: 'FIXME go-ipfs returns an error https://github.com/ipfs/go-ipfs/issues/4078' |
| 33 | + } |
| 34 | + ] |
| 35 | + }) |
| 36 | + |
| 37 | + tests.block(defaultCommonFactory) |
| 38 | + |
| 39 | + tests.bootstrap(defaultCommonFactory) |
| 40 | + |
| 41 | + tests.config(defaultCommonFactory, { |
| 42 | + skip: [ |
| 43 | + // config.replace |
| 44 | + { |
| 45 | + name: 'replace', |
| 46 | + reason: 'FIXME Waiting for fix on go-ipfs https://github.com/ipfs/js-ipfs-api/pull/307#discussion_r69281789 and https://github.com/ipfs/go-ipfs/issues/2927' |
| 47 | + } |
| 48 | + ] |
| 49 | + }) |
| 50 | + |
| 51 | + tests.dag(defaultCommonFactory, { |
| 52 | + skip: [ |
| 53 | + // dag.tree |
| 54 | + { |
| 55 | + name: 'tree', |
| 56 | + reason: 'TODO vmx 2018-02-22: Currently the tree API is not exposed in go-ipfs' |
| 57 | + }, |
| 58 | + // dag.get: |
| 59 | + { |
| 60 | + name: 'should get a dag-pb node local value', |
| 61 | + 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' |
| 62 | + }, |
| 63 | + { |
| 64 | + name: 'should get dag-pb value via dag-cbor node', |
| 65 | + 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' |
| 66 | + }, |
| 67 | + { |
| 68 | + name: 'should get by CID string + path', |
| 69 | + 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' |
| 70 | + } |
| 71 | + ] |
| 72 | + }) |
| 73 | + |
| 74 | + tests.dht(defaultCommonFactory, { |
| 75 | + skip: [ |
| 76 | + // dht.findpeer |
| 77 | + { |
| 78 | + name: 'should fail to find other peer if peer does not exist', |
| 79 | + reason: 'FIXME checking what is exactly go-ipfs returning https://github.com/ipfs/go-ipfs/issues/3862#issuecomment-294168090' |
| 80 | + }, |
| 81 | + // dht.findprovs |
| 82 | + { |
| 83 | + name: 'should provide from one node and find it through another node', |
| 84 | + reason: 'FIXME go-ipfs endpoint doesn\'t conform with the others https://github.com/ipfs/go-ipfs/issues/5047' |
| 85 | + }, |
| 86 | + // dht.get |
| 87 | + { |
| 88 | + name: 'should get a value after it was put on another node', |
| 89 | + reason: 'FIXME go-ipfs errors with Error: key was not found (type 6) https://github.com/ipfs/go-ipfs/issues/3862' |
| 90 | + } |
| 91 | + ] |
| 92 | + }) |
| 93 | + |
| 94 | + tests.files(defaultCommonFactory, { |
| 95 | + skip: [ |
| 96 | + // files.add |
| 97 | + isNode ? null : { |
| 98 | + name: 'should add a nested directory as array of tupples', |
| 99 | + reason: 'FIXME https://github.com/ipfs/js-ipfs-api/issues/339' |
| 100 | + }, |
| 101 | + isNode ? null : { |
| 102 | + name: 'should add a nested directory as array of tupples with progress', |
| 103 | + reason: 'FIXME https://github.com/ipfs/js-ipfs-api/issues/339' |
| 104 | + }, |
| 105 | + // files.addPullStream |
| 106 | + isNode ? null : { |
| 107 | + name: 'should add pull stream of valid files and dirs', |
| 108 | + reason: 'FIXME https://github.com/ipfs/js-ipfs-api/issues/339' |
| 109 | + }, |
| 110 | + // files.addReadableStream |
| 111 | + isNode ? null : { |
| 112 | + name: 'should add readable stream of valid files and dirs', |
| 113 | + reason: 'FIXME https://github.com/ipfs/js-ipfs-api/issues/339' |
| 114 | + }, |
| 115 | + // files.catPullStream |
| 116 | + { |
| 117 | + name: 'should export a chunk of a file', |
| 118 | + reason: 'TODO not implemented in go-ipfs yet' |
| 119 | + }, |
| 120 | + { |
| 121 | + name: 'should export a chunk of a file in a Pull Stream', |
| 122 | + reason: 'TODO not implemented in go-ipfs yet' |
| 123 | + }, |
| 124 | + { |
| 125 | + name: 'should export a chunk of a file in a Readable Stream', |
| 126 | + reason: 'TODO not implemented in go-ipfs yet' |
| 127 | + }, |
| 128 | + // files.get |
| 129 | + isNode ? null : { |
| 130 | + name: 'should get a directory', |
| 131 | + reason: 'FIXME https://github.com/ipfs/js-ipfs-api/issues/339' |
| 132 | + } |
| 133 | + ] |
| 134 | + }) |
| 135 | + |
| 136 | + tests.key(defaultCommonFactory, { |
| 137 | + skip: [ |
| 138 | + // key.export |
| 139 | + { |
| 140 | + name: 'export', |
| 141 | + reason: 'TODO not implemented in go-ipfs yet' |
| 142 | + }, |
| 143 | + // key.import |
| 144 | + { |
| 145 | + name: 'import', |
| 146 | + reason: 'TODO not implemented in go-ipfs yet' |
| 147 | + } |
| 148 | + ] |
| 149 | + }) |
| 150 | + |
| 151 | + tests.ls(defaultCommonFactory, { |
| 152 | + skip: [ |
| 153 | + // lsPullStream |
| 154 | + isNode ? null : { |
| 155 | + name: 'should pull stream ls with a base58 encoded CID', |
| 156 | + reason: 'FIXME https://github.com/ipfs/js-ipfs-api/issues/339' |
| 157 | + }, |
| 158 | + // lsReadableStream |
| 159 | + isNode ? null : { |
| 160 | + name: 'should readable stream ls with a base58 encoded CID', |
| 161 | + reason: 'FIXME https://github.com/ipfs/js-ipfs-api/issues/339' |
| 162 | + }, |
| 163 | + // ls |
| 164 | + isNode ? null : { |
| 165 | + name: 'should ls with a base58 encoded CID', |
| 166 | + reason: 'FIXME https://github.com/ipfs/js-ipfs-api/issues/339' |
| 167 | + } |
| 168 | + ] |
| 169 | + }) |
| 170 | + |
| 171 | + tests.miscellaneous(defaultCommonFactory, { |
| 172 | + skip: [ |
| 173 | + // stop |
| 174 | + { |
| 175 | + name: 'should stop the node', |
| 176 | + reason: 'FIXME go-ipfs returns an error https://github.com/ipfs/go-ipfs/issues/4078' |
| 177 | + } |
| 178 | + ] |
| 179 | + }) |
| 180 | + |
| 181 | + tests.object(defaultCommonFactory) |
| 182 | + |
| 183 | + tests.pin(defaultCommonFactory) |
| 184 | + |
| 185 | + tests.ping(defaultCommonFactory) |
| 186 | + |
| 187 | + tests.pubsub(CommonFactory.create({ |
| 188 | + spawnOptions: { |
| 189 | + args: ['--enable-pubsub-experiment'], |
| 190 | + initOptions: { bits: 1024 } |
| 191 | + } |
| 192 | + }), { |
| 193 | + skip: isNode ? [ |
| 194 | + // pubsub.subscribe |
| 195 | + isWindows ? { |
| 196 | + name: 'should send/receive 100 messages', |
| 197 | + reason: 'FIXME https://github.com/ipfs/interface-ipfs-core/pull/188#issuecomment-354673246 and https://github.com/ipfs/go-ipfs/issues/4778' |
| 198 | + } : null, |
| 199 | + isWindows ? { |
| 200 | + name: 'should receive multiple messages', |
| 201 | + reason: 'FIXME https://github.com/ipfs/interface-ipfs-core/pull/188#issuecomment-354673246 and https://github.com/ipfs/go-ipfs/issues/4778' |
| 202 | + } : null |
| 203 | + ] : { |
| 204 | + reason: 'FIXME pubsub is not supported in the browser https://github.com/ipfs/js-ipfs-api/issues/518' |
| 205 | + } |
| 206 | + }) |
| 207 | + |
| 208 | + tests.repo(defaultCommonFactory) |
| 209 | + |
| 210 | + tests.stats(defaultCommonFactory) |
| 211 | + |
| 212 | + tests.swarm(CommonFactory.create({ |
| 213 | + createSetup ({ ipfsFactory, nodes }) { |
| 214 | + return callback => { |
| 215 | + callback(null, { |
| 216 | + spawnNode (repoPath, config, cb) { |
| 217 | + if (typeof repoPath === 'function') { |
| 218 | + cb = repoPath |
| 219 | + repoPath = undefined |
| 220 | + } |
| 221 | + |
| 222 | + if (typeof config === 'function') { |
| 223 | + cb = config |
| 224 | + config = undefined |
| 225 | + } |
| 226 | + |
| 227 | + const spawnOptions = { repoPath, config, initOptions: { bits: 1024 } } |
| 228 | + |
| 229 | + ipfsFactory.spawn(spawnOptions, (err, _ipfsd) => { |
| 230 | + if (err) { |
| 231 | + return cb(err) |
| 232 | + } |
| 233 | + |
| 234 | + nodes.push(_ipfsd) |
| 235 | + cb(null, IPFSApi(_ipfsd.apiAddr)) |
| 236 | + }) |
| 237 | + } |
| 238 | + }) |
| 239 | + } |
| 240 | + } |
| 241 | + })) |
| 242 | + |
| 243 | + tests.types(defaultCommonFactory, { skip: { reason: 'FIXME currently failing' } }) |
| 244 | + |
| 245 | + tests.util(defaultCommonFactory, { skip: { reason: 'FIXME currently failing' } }) |
| 246 | +}) |
0 commit comments