|
| 1 | +/* eslint-env mocha */ |
| 2 | +'use strict' |
| 3 | + |
| 4 | +const tests = require('interface-ipfs-core') |
| 5 | +const CommonFactory = require('./utils/interface-common-factory') |
| 6 | +const IPFSApi = require('../src') |
| 7 | + |
| 8 | +describe('interface-ipfs-core tests', () => { |
| 9 | + const defaultCommonFactory = CommonFactory.create() |
| 10 | + |
| 11 | + tests.block(defaultCommonFactory) |
| 12 | + |
| 13 | + tests.bootstrap(defaultCommonFactory) |
| 14 | + |
| 15 | + tests.config(defaultCommonFactory) |
| 16 | + |
| 17 | + tests.dag(defaultCommonFactory, { |
| 18 | + skip: [ |
| 19 | + // dag.tree |
| 20 | + // |
| 21 | + // FIXME vmx 2018-02-22: Currently the tree API is not exposed in go-ipfs |
| 22 | + 'tree', |
| 23 | + // dag.get: |
| 24 | + // |
| 25 | + // FIXME vmx 2018-02-22: Currently not supported in go-ipfs, it might |
| 26 | + // be possible once https://github.com/ipfs/go-ipfs/issues/4728 is |
| 27 | + // done |
| 28 | + 'should get a dag-pb node local value', |
| 29 | + 'should get dag-pb value via dag-cbor node', |
| 30 | + 'should get by CID string + path', |
| 31 | + // dag.put |
| 32 | + // |
| 33 | + // FIXME This works in go-ipfs because dag-pb will serialize any object. If |
| 34 | + // the object has neither a `data` nor `links` field it's serialized |
| 35 | + // as an empty object |
| 36 | + 'should not put dag-cbor node with wrong multicodec' |
| 37 | + ] |
| 38 | + }) |
| 39 | + |
| 40 | + tests.dht(defaultCommonFactory, { |
| 41 | + skip: [ |
| 42 | + // dht.findpeer |
| 43 | + // |
| 44 | + // FIXME checking what is exactly go-ipfs returning |
| 45 | + // https://github.com/ipfs/go-ipfs/issues/3862#issuecomment-294168090 |
| 46 | + 'should fail to find other peer if peer does not exist', |
| 47 | + // dht.findprovs |
| 48 | + // |
| 49 | + // FIXME go-ipfs endpoint doesn't conform with the others |
| 50 | + // https://github.com/ipfs/go-ipfs/issues/5047 |
| 51 | + 'should provide from one node and find it through another node', |
| 52 | + // dht.get |
| 53 | + // |
| 54 | + // FIXME go-ipfs errors with Error: key was not found (type 6) |
| 55 | + // https://github.com/ipfs/go-ipfs/issues/3862 |
| 56 | + 'should get a value after it was put on another node' |
| 57 | + ] |
| 58 | + }) |
| 59 | + |
| 60 | + tests.files(defaultCommonFactory) |
| 61 | + |
| 62 | + tests.generic(CommonFactory.create({ |
| 63 | + // No need to stop, because the test suite does a 'stop' test. |
| 64 | + createTeardown: cb => cb() |
| 65 | + })) |
| 66 | + |
| 67 | + tests.key(defaultCommonFactory) |
| 68 | + |
| 69 | + tests.object(defaultCommonFactory) |
| 70 | + |
| 71 | + tests.ping(defaultCommonFactory) |
| 72 | + |
| 73 | + tests.pubsub(CommonFactory.create({ |
| 74 | + spawnOptions: { |
| 75 | + args: ['--enable-pubsub-experiment'], |
| 76 | + initOptions: { bits: 1024 } |
| 77 | + } |
| 78 | + })) |
| 79 | + |
| 80 | + tests.repo(defaultCommonFactory) |
| 81 | + |
| 82 | + tests.stats(defaultCommonFactory) |
| 83 | + |
| 84 | + tests.swarm(CommonFactory.create({ |
| 85 | + createSetup ({ ipfsFactory, nodes }) { |
| 86 | + return callback => { |
| 87 | + callback(null, { |
| 88 | + spawnNode (repoPath, config, cb) { |
| 89 | + if (typeof repoPath === 'function') { |
| 90 | + cb = repoPath |
| 91 | + repoPath = undefined |
| 92 | + } |
| 93 | + |
| 94 | + if (typeof config === 'function') { |
| 95 | + cb = config |
| 96 | + config = undefined |
| 97 | + } |
| 98 | + |
| 99 | + const spawnOptions = { repoPath, config, initOptions: { bits: 1024 } } |
| 100 | + |
| 101 | + ipfsFactory.spawn(spawnOptions, (err, _ipfsd) => { |
| 102 | + if (err) { |
| 103 | + return cb(err) |
| 104 | + } |
| 105 | + |
| 106 | + nodes.push(_ipfsd) |
| 107 | + cb(null, IPFSApi(_ipfsd.apiAddr)) |
| 108 | + }) |
| 109 | + } |
| 110 | + }) |
| 111 | + } |
| 112 | + } |
| 113 | + })) |
| 114 | +}) |
0 commit comments