Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
describe('interface-ipfs-core tests', () => {
/** @type ControllerOptions */
const commonOptions = {
test: true,
ipfsHttpModule: {
path: require.resolve('../src'),
ref: require('../src')
},
ipfsOptions: {
pass: 'ipfs-is-awesome-software'
},
ipfsBin: findBin('go')
}
const commonFactory = createFactory(commonOptions)
tests.bitswap(commonFactory)
tests.block(commonFactory, {
skip: [{
name: 'should get a block added as CIDv1 with a CIDv0',
reason: 'go-ipfs does not support the `version` param'
}]
})
tests.bootstrap(commonFactory)
tests.config(commonFactory, {
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'
describe('interface-ipfs-core tests', () => {
const defaultCommon = CommonFactory.create()
tests.bitswap(defaultCommon, {
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'
}
]
})
tests.block(defaultCommon, {
skip: [{
ipfsHttpModule: {
path: require.resolve('ipfs-http-client'),
ref: require('ipfs-http-client')
},
ipfsOptions: {
pass: 'ipfs-is-awesome-software'
}
}
const overrides = {
js: {
ipfsBin: './src/cli/bin.js'
}
}
const commonFactory = createFactory(commonOptions, overrides)
tests.bitswap(commonFactory)
tests.block(commonFactory)
tests.bootstrap(commonFactory)
tests.config(commonFactory)
tests.dag(commonFactory, {
skip: [{
name: 'should get only a CID, due to resolving locally only',
reason: 'Local resolve option is not implemented yet'
}, {
name: 'tree',
reason: 'dag.tree is not implemented yet'
}]
})
const IpfsFactory = require('./helpers/factories/browser')
const defaultCommonFactory = () => {
let factory
return {
setup (cb) {
factory = new IpfsFactory()
cb(null, factory)
},
teardown (cb) {
factory.dismantle(cb)
}
}
}
tests.bitswap(defaultCommonFactory, { skip: true })
tests.block(defaultCommonFactory)
tests.bootstrap(defaultCommonFactory)
tests.config(defaultCommonFactory)
tests.dag(defaultCommonFactory)
tests.dht(defaultCommonFactory, {
skip: { reason: 'TODO: DHT is not implemented in js-ipfs yet!' }
})
tests.files(defaultCommonFactory, {
skip: [
{
ipfsHttpModule: {
path: require.resolve('ipfs-http-client'),
ref: require('ipfs-http-client')
},
ipfsOptions: {
pass: 'ipfs-is-awesome-software'
}
}
const overrides = {
js: {
ipfsBin: './src/cli/bin.js'
}
}
const commonFactory = createFactory(commonOptions, overrides)
tests.bitswap(commonFactory)
tests.block(commonFactory)
tests.bootstrap(commonFactory)
tests.config(commonFactory)
tests.dag(commonFactory)
tests.dht(commonFactory, {
skip: {
reason: 'TODO: unskip when DHT is enabled: https://github.com/ipfs/js-ipfs/pull/1994'
}
})
tests.filesRegular(commonFactory, {