Add test-utils
dignifiedquire opened this issue ยท 6 comments
Currently the setup and teardown of a repo with pre populated data is copy and pasted over most js-ipfs repos. To fix this add
repo.load('path-to-repo', cb)
which doesrepo.delete(cb)
which does
What if we make this a separate module ipfs-repo-utils
? @pgte wanna take a look at this?
It might be the case that having them here is also fine. I'm just considering adding more code to the bundles. Probably having a ipfs-repo/src/utils
would do fine, it would be requiring internals, but it would be just at tests level, so any mistake there won't break any installs.
I think this is badly needed in tests, but I also think we shouldn't add to any browser bundle.
My opinion is that this should be a separate require like a separate repo or, more simply require('ipfs-repo/utils')
.
I tend to like this last one better (ETOOMANYREPOS)..
agree with @pgte not another repo please, just publish it along side in its own file such that browser bundlers don't pick it up unless you explicitly require it
Closing because the approach now is to not have dependencies of IPFS depend on IPFS, so most of them don't have repos in their tests.