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: 'should fail when pinging an unknown peer over pull stream',
reason: 'FIXME go-ipfs return success with text: Looking up peer '
},
{
name: 'should fail when pinging peer that is not available over readable stream',
reason: 'FIXME go-ipfs return success with text: Looking up peer '
},
{
name: 'should fail when pinging a peer that is not available',
reason: 'FIXME go-ipfs return success with text: Looking up peer '
}
]
})
tests.pubsub(createFactory(commonOptions, {
go: {
args: ['--enable-pubsub-experiment']
}
}), {
skip: isWindows ? [
// pubsub.subscribe
{
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'
},
{
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
})
{
ipfsOptions: {
offline: true
}
}
)), {
skip: [
// stop
{
name: 'should resolve a record from peerid as cidv1 in base32',
reason: 'TODO not implemented in go-ipfs yet: https://github.com/ipfs/go-ipfs/issues/5287'
}
]
})
tests.namePubsub(createFactory(merge(commonOptions,
{
ipfsOptions: {
EXPERIMENTAL: {
ipnsPubsub: true
}
}
}
)), {
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
{
}]
})
tests.filesMFS(commonFactory)
tests.key(commonFactory)
tests.miscellaneous(commonFactory)
tests.name(createFactory(merge(commonOptions, {
ipfsOptions: {
offline: true
}
}), overrides))
tests.namePubsub(createFactory(merge(commonOptions, {
ipfsOptions: {
EXPERIMENTAL: {
ipnsPubsub: true
}
}
}), overrides))
tests.object(commonFactory, {
skip: [
{
name: 'should respect timeout option',
reason: 'js-ipfs doesn\'t support timeout yet'
}
]
})
ref: IPFS
},
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'
})
tests.filesMFS(commonFactory)
tests.key(commonFactory)
tests.miscellaneous(commonFactory)
tests.name(createFactory(merge(commonOptions, {
ipfsOptions: {
pass: 'ipfs-is-awesome-software',
offline: true
}
}), overrides))
tests.namePubsub(createFactory(merge(commonOptions, {
ipfsOptions: {
EXPERIMENTAL: {
ipnsPubsub: true
}
}
}), overrides))
tests.object(commonFactory)
tests.pin(commonFactory)
tests.ping(commonFactory)
tests.pubsub(createFactory(commonOptions, merge(overrides, {
go: {
args: ['--enable-pubsub-experiment']
skip: isNode ? null : [{
name: 'addFromStream',
reason: 'Not designed to run in the browser'
}, {
name: 'addFromFs',
reason: 'Not designed to run in the browser'
}]
})
tests.filesMFS(commonFactory)
tests.key(commonFactory)
tests.miscellaneous(commonFactory)
tests.name(createFactory(merge(commonOptions, {
ipfsOptions: {
pass: 'ipfs-is-awesome-software',
offline: true
}
}), overrides))
tests.namePubsub(createFactory(merge(commonOptions, {
ipfsOptions: {
EXPERIMENTAL: {
ipnsPubsub: true
}
}
}), overrides))
tests.object(commonFactory)
skip: isNode ? null : [{
name: 'addFromStream',
reason: 'Not designed to run in the browser'
}, {
name: 'addFromFs',
reason: 'Not designed to run in the browser'
}]
})
tests.filesMFS(commonFactory)
tests.key(commonFactory)
tests.miscellaneous(commonFactory)
tests.name(createFactory(merge(commonOptions, {
ipfsOptions: {
offline: true
}
}), overrides))
tests.namePubsub(createFactory(merge(commonOptions, {
ipfsOptions: {
EXPERIMENTAL: {
ipnsPubsub: true
}
}
}), overrides))
tests.object(commonFactory, {
skip: [
{
'use strict'
const { createFactory } = require('ipfsd-ctl')
const { findBin } = require('ipfsd-ctl/src/utils')
const factory = createFactory({
test: 'true',
type: 'go',
ipfsBin: findBin('go'),
ipfsHttpModule: {
path: require.resolve('../../src'),
ref: require('../../src')
}
})
module.exports = factory
}), overrides))
tests.object(commonFactory, {
skip: [
{
name: 'should respect timeout option',
reason: 'js-ipfs doesn\'t support timeout yet'
}
]
})
tests.pin(commonFactory)
tests.ping(commonFactory)
tests.pubsub(createFactory(commonOptions, merge(overrides, {
go: {
args: ['--enable-pubsub-experiment']
}
})), {
skip: [
{
name: 'should receive messages from a different node',
reason: 'https://github.com/ipfs/js-ipfs/issues/2662'
},
{
name: 'should round trip a non-utf8 binary buffer',
reason: 'https://github.com/ipfs/js-ipfs/issues/2662'
},
{
name: 'should receive multiple messages',
reason: 'https://github.com/ipfs/js-ipfs/issues/2662'