Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

feat: modular interface tests #1389

Merged
merged 19 commits into from
Jul 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"expose-loader": "~0.7.5",
"form-data": "^2.3.2",
"hat": "0.0.3",
"interface-ipfs-core": "~0.69.2",
"interface-ipfs-core": "~0.70.2",
"ipfsd-ctl": "~0.37.3",
"mocha": "^5.1.1",
"ncp": "^2.0.0",
Expand Down
155 changes: 155 additions & 0 deletions test/core/interface.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
/* eslint-env mocha */
'use strict'

const tests = require('interface-ipfs-core')
const CommonFactory = require('../utils/interface-common-factory')
const isNode = require('detect-node')

describe('interface-ipfs-core tests', () => {
const defaultCommonFactory = CommonFactory.create()

tests.bitswap(defaultCommonFactory, { skip: !isNode })

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: [
{
name: 'cp',
reason: 'TODO: MFS is not implemented in js-ipfs yet!'
},
{
name: 'mkdir',
reason: 'TODO: MFS is not implemented in js-ipfs yet!'
},
{
name: 'stat',
reason: 'TODO: MFS is not implemented in js-ipfs yet!'
},
{
name: 'rm',
reason: 'TODO: MFS is not implemented in js-ipfs yet!'
},
{
name: 'read',
reason: 'TODO: MFS is not implemented in js-ipfs yet!'
},
{
name: 'readReadableStream',
reason: 'TODO: MFS is not implemented in js-ipfs yet!'
},
{
name: 'readPullStream',
reason: 'TODO: MFS is not implemented in js-ipfs yet!'
},
{
name: 'write',
reason: 'TODO: MFS is not implemented in js-ipfs yet!'
},
{
name: 'mv',
reason: 'TODO: MFS is not implemented in js-ipfs yet!'
},
{
name: 'flush',
reason: 'TODO: MFS is not implemented in js-ipfs yet!'
},
{
name: 'ls',
reason: 'TODO: MFS is not implemented in js-ipfs yet!'
}
]
})

tests.key(CommonFactory.create({
spawnOptions: {
args: ['--pass ipfs-is-awesome-software'],
initOptions: { bits: 512 }
}
}))

tests.ls(defaultCommonFactory)

tests.miscellaneous(CommonFactory.create({
// No need to stop, because the test suite does a 'stop' test.
createTeardown: () => cb => cb()
}))

tests.object(defaultCommonFactory)

tests.pin(defaultCommonFactory)

tests.ping(defaultCommonFactory, {
skip: isNode ? null : {
reason: 'FIXME: ping implementation requires DHT'
}
})

tests.pubsub(CommonFactory.create({
spawnOptions: {
args: ['--enable-pubsub-experiment'],
initOptions: { bits: 512 }
}
}), {
skip: isNode ? null : {
reason: 'FIXME: disabled because no swarm addresses'
}
})

tests.repo(defaultCommonFactory, {
skip: [
// repo.gc
{
name: 'gc',
reason: 'TODO: repo.gc is not implemented in js-ipfs yet!'
}
]
})

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: 512 } }

ipfsFactory.spawn(spawnOptions, (err, _ipfsd) => {
if (err) {
return cb(err)
}

nodes.push(_ipfsd)
cb(null, _ipfsd.api)
})
}
})
}
}
}), { skip: !isNode })

tests.types(defaultCommonFactory, { skip: { reason: 'FIXME: currently failing' } })

tests.util(defaultCommonFactory, { skip: { reason: 'FIXME: currently failing' } })
})
35 changes: 0 additions & 35 deletions test/core/interface/bitswap.js

This file was deleted.

35 changes: 0 additions & 35 deletions test/core/interface/block.js

This file was deleted.

35 changes: 0 additions & 35 deletions test/core/interface/bootstrap.js

This file was deleted.

35 changes: 0 additions & 35 deletions test/core/interface/config.js

This file was deleted.

35 changes: 0 additions & 35 deletions test/core/interface/dag.js

This file was deleted.

32 changes: 0 additions & 32 deletions test/core/interface/dht.js

This file was deleted.

Loading