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

Commit

Permalink
feat: modular interface tests (#1389)
Browse files Browse the repository at this point in the history
* chore: update interface-ipfs-core dependency

License: MIT
Signed-off-by: Alan Shaw <[email protected]>

* chore: update interface-ipfs-core dependency

License: MIT
Signed-off-by: Alan Shaw <[email protected]>

* chore: add skip for DAG subsystem over HTTP API

License: MIT
Signed-off-by: Alan Shaw <[email protected]>

* chore: update interface-ipfs-core version

License: MIT
Signed-off-by: Alan Shaw <[email protected]>

* fix: disable pubsub tests in the browser

License: MIT
Signed-off-by: Alan Shaw <[email protected]>

* feat: uses modular interface tests

Reduces code repetition, allows test skipping and running only some tests.

License: MIT
Signed-off-by: Alan Shaw <[email protected]>

* fix: remove .only

License: MIT
Signed-off-by: Alan Shaw <[email protected]>

* fix: skip DHT and MFS tests, add repo tests but skip gc

License: MIT
Signed-off-by: Alan Shaw <[email protected]>

* feat: enables ipfs.ls* tests

License: MIT
Signed-off-by: Alan Shaw <[email protected]>

* fix: teardown for miscellaneous tests

License: MIT
Signed-off-by: Alan Shaw <[email protected]>

* chore: rename generic to miscellaneous

License: MIT
Signed-off-by: Alan Shaw <[email protected]>

* feat: add types and util tests (skipped as currently failing)

License: MIT
Signed-off-by: Alan Shaw <[email protected]>

* chore: adds comments to skipped tests

License: MIT
Signed-off-by: Alan Shaw <[email protected]>

* fix: adds skips

License: MIT
Signed-off-by: Alan Shaw <[email protected]>

* fix: fixes spawn args to key tests

License: MIT
Signed-off-by: Alan Shaw <[email protected]>

* fix: misc tests do not require teardown

License: MIT
Signed-off-by: Alan Shaw <[email protected]>

* fix: remove unnecessary skip

License: MIT
Signed-off-by: Alan Shaw <[email protected]>

* chore: re-add bitswap tests

License: MIT
Signed-off-by: Alan Shaw <[email protected]>

* chore: add test skip reasons

License: MIT
Signed-off-by: Alan Shaw <[email protected]>
  • Loading branch information
alanshaw authored and daviddias committed Jul 2, 2018
1 parent 9c60909 commit 18888be
Show file tree
Hide file tree
Showing 30 changed files with 353 additions and 885 deletions.
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

0 comments on commit 18888be

Please sign in to comment.