This repository has been archived by the owner on Feb 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: modular interface tests (#1389)
* chore: update interface-ipfs-core dependency License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * chore: update interface-ipfs-core dependency License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * chore: add skip for DAG subsystem over HTTP API License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * chore: update interface-ipfs-core version License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * fix: disable pubsub tests in the browser License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * feat: uses modular interface tests Reduces code repetition, allows test skipping and running only some tests. License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * fix: remove .only License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * fix: skip DHT and MFS tests, add repo tests but skip gc License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * feat: enables ipfs.ls* tests License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * fix: teardown for miscellaneous tests License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * chore: rename generic to miscellaneous License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * feat: add types and util tests (skipped as currently failing) License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * chore: adds comments to skipped tests License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * fix: adds skips License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * fix: fixes spawn args to key tests License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * fix: misc tests do not require teardown License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * fix: remove unnecessary skip License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * chore: re-add bitswap tests License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * chore: add test skip reasons License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io>
- Loading branch information
Showing
30 changed files
with
353 additions
and
885 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' } }) | ||
}) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.