diff --git a/karma.conf.js b/karma.conf.js index 5675220731..ddd7c8caf2 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -8,11 +8,11 @@ module.exports = function (config) { files: [ nodeForgePath, - 'tests/test-core/browser.js' + 'test/core-tests/browser.js' ], preprocessors: { - 'tests/test-core/*': ['webpack'] + 'test/core-tests/*': ['webpack'] }, webpack: { diff --git a/package.json b/package.json index 5351b0869d..6a70568c99 100644 --- a/package.json +++ b/package.json @@ -8,21 +8,21 @@ "main": "src/core/index.js", "scripts": { "lint": "standard --verbose | snazzy", - "coverage": "istanbul cover --print both -- _mocha tests/test-core/index.js", - "coverage:http-api": "istanbul cover --print both -- _mocha tests/test-http-api/index.js", + "coverage": "istanbul cover --print both -- _mocha test/core-tests/index.js", + "coverage:http-api": "istanbul cover --print both -- _mocha test/http-api-tests/index.js", "test": "npm run test:node && npm run test:browser", "test:node": "npm run test:node:core && npm run test:node:http-api && npm run test:node:cli", "test:node:teamcity": "npm run test:node:core:teamcity && npm run test:node:http-api:teamcity && npm run test:node:cli:teamcity", - "test:node:cli:teamcity": "mocha --reporter mocha-teamcity-reporter tests/test-cli/index.js", - "test:node:core:teamcity": "mocha --reporter mocha-teamcity-reporter tests/test-core/index.js", - "test:node:http-api:teamcity": "mocha --reporter mocha-teamcity-reporter tests/test-http-api/index.js", - "test:node:cli": "mocha tests/test-cli/index.js", - "test:node:core": "mocha tests/test-core/index.js", - "test:node:http-api": "mocha tests/test-http-api/index.js", + "test:node:cli:teamcity": "mocha --reporter mocha-teamcity-reporter test/cli-tests/index.js", + "test:node:core:teamcity": "mocha --reporter mocha-teamcity-reporter test/core-tests/index.js", + "test:node:http-api:teamcity": "mocha --reporter mocha-teamcity-reporter test/http-api-tests/index.js", + "test:node:cli": "mocha test/cli-tests/index.js", + "test:node:core": "mocha test/core-tests/index.js", + "test:node:http-api": "mocha test/http-api-tests/index.js", "test:browser": "karma start karma.conf.js", "test:browser:teamcity": "karma start --reporters teamcity --colors false karma.conf.js", - "test:core": "mocha tests/test-core/index.js", - "test:cli": "mocha tests/test-cli/index.js" + "test:core": "mocha test/core-tests/index.js", + "test:cli": "mocha test/cli-tests/index.js" }, "pre-commit": [ "lint", diff --git a/src/core/init.js b/src/core/init.js index a491f0c40a..9d8f8a867a 100644 --- a/src/core/init.js +++ b/src/core/init.js @@ -10,7 +10,7 @@ module.exports = (repo, opts, callback) => { opts.bits = opts.bits || 2048 // Pre-set config values. - var config = require('../../default-config.json') + var config = require('../init-files/default-config.json') // Verify repo does not yet exist (or that 'force' is provided). repo.exists((err, res) => { @@ -65,7 +65,7 @@ module.exports = (repo, opts, callback) => { const blocks = new IpfsBlocks(repo) const dag = new IpfsDagService(blocks) - const initDocsPath = path.join(__dirname, '../../init-doc') + const initDocsPath = path.join(__dirname, '../init-files/init-docs') importer.import(initDocsPath, dag, { recursive: true diff --git a/default-config.json b/src/init-files/default-config.json similarity index 100% rename from default-config.json rename to src/init-files/default-config.json diff --git a/init-doc/about b/src/init-files/init-docs/about similarity index 100% rename from init-doc/about rename to src/init-files/init-docs/about diff --git a/init-doc/contact b/src/init-files/init-docs/contact similarity index 100% rename from init-doc/contact rename to src/init-files/init-docs/contact diff --git a/init-doc/docs/index b/src/init-files/init-docs/docs/index similarity index 100% rename from init-doc/docs/index rename to src/init-files/init-docs/docs/index diff --git a/init-doc/help b/src/init-files/init-docs/help similarity index 100% rename from init-doc/help rename to src/init-files/init-docs/help diff --git a/init-doc/quick-start b/src/init-files/init-docs/quick-start similarity index 100% rename from init-doc/quick-start rename to src/init-files/init-docs/quick-start diff --git a/init-doc/readme b/src/init-files/init-docs/readme similarity index 100% rename from init-doc/readme rename to src/init-files/init-docs/readme diff --git a/init-doc/security-notes b/src/init-files/init-docs/security-notes similarity index 100% rename from init-doc/security-notes rename to src/init-files/init-docs/security-notes diff --git a/init-doc/tour/0.0-intro b/src/init-files/init-docs/tour/0.0-intro similarity index 100% rename from init-doc/tour/0.0-intro rename to src/init-files/init-docs/tour/0.0-intro diff --git a/tests/test-cli/index.js b/test/cli-tests/index.js similarity index 83% rename from tests/test-cli/index.js rename to test/cli-tests/index.js index f5a9bdaa4d..72626e32c2 100644 --- a/tests/test-cli/index.js +++ b/test/cli-tests/index.js @@ -6,8 +6,8 @@ const rimraf = require('rimraf') const expect = require('chai').expect describe('cli', () => { - const repoExample = process.cwd() + '/tests/repo-example' - const repoTests = exports.repoTests = process.cwd() + '/tests/repo-tests-run' + const repoExample = process.cwd() + '/test/go-ipfs-repo' + const repoTests = exports.repoTests = process.cwd() + '/test/repo-tests-run' before((done) => { ncp(repoExample, repoTests, (err) => { diff --git a/tests/test-cli/test-bootstrap.js b/test/cli-tests/test-bootstrap.js similarity index 100% rename from tests/test-cli/test-bootstrap.js rename to test/cli-tests/test-bootstrap.js diff --git a/tests/test-cli/test-commands.js b/test/cli-tests/test-commands.js similarity index 100% rename from tests/test-cli/test-commands.js rename to test/cli-tests/test-commands.js diff --git a/tests/test-cli/test-config.js b/test/cli-tests/test-config.js similarity index 100% rename from tests/test-cli/test-config.js rename to test/cli-tests/test-config.js diff --git a/tests/test-cli/test-id.js b/test/cli-tests/test-id.js similarity index 100% rename from tests/test-cli/test-id.js rename to test/cli-tests/test-id.js diff --git a/tests/test-cli/test-object.js b/test/cli-tests/test-object.js similarity index 95% rename from tests/test-cli/test-object.js rename to test/cli-tests/test-object.js index b10c5befa8..edc825009e 100644 --- a/tests/test-cli/test-object.js +++ b/test/cli-tests/test-object.js @@ -32,7 +32,7 @@ describe('object', () => { }) it('put', (done) => { - nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'object', 'put', process.cwd() + '/tests/node.json']) + nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'object', 'put', process.cwd() + '/test/test-data/node.json']) .run((err, stdout, exitcode) => { expect(err).to.not.exist expect(exitcode).to.equal(0) @@ -81,7 +81,7 @@ describe('object', () => { describe('patch', () => { it('append-data', (done) => { - nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'object', 'patch', 'append-data', 'QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n', process.cwd() + '/tests/badconfig']) + nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'object', 'patch', 'append-data', 'QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n', process.cwd() + '/test/test-data/badconfig']) .run((err, stdout, exitcode) => { expect(err).to.not.exist expect(exitcode).to.equal(0) @@ -92,7 +92,7 @@ describe('object', () => { }) it('set-data', (done) => { - nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'object', 'patch', 'set-data', 'QmfY37rjbPCZRnhvvJuQ46htW3VCAWziVB991P79h6WSv6', process.cwd() + '/tests/badconfig']) + nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'object', 'patch', 'set-data', 'QmfY37rjbPCZRnhvvJuQ46htW3VCAWziVB991P79h6WSv6', process.cwd() + '/test/test-data/badconfig']) .run((err, stdout, exitcode) => { expect(err).to.not.exist expect(exitcode).to.equal(0) @@ -167,7 +167,7 @@ describe('object', () => { }) it('put', (done) => { - nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'object', 'put', process.cwd() + '/tests/node.json']) + nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'object', 'put', process.cwd() + '/test/test-data/node.json']) .run((err, stdout, exitcode) => { expect(err).to.not.exist expect(exitcode).to.equal(0) @@ -216,7 +216,7 @@ describe('object', () => { describe('patch', () => { it('append-data', (done) => { - nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'object', 'patch', 'append-data', 'QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n', process.cwd() + '/tests/badconfig']) + nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'object', 'patch', 'append-data', 'QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n', process.cwd() + '/test/test-data/badconfig']) .run((err, stdout, exitcode) => { expect(err).to.not.exist expect(exitcode).to.equal(0) @@ -227,7 +227,7 @@ describe('object', () => { }) it('set-data', (done) => { - nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'object', 'patch', 'set-data', 'QmfY37rjbPCZRnhvvJuQ46htW3VCAWziVB991P79h6WSv6', process.cwd() + '/tests/badconfig']) + nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'object', 'patch', 'set-data', 'QmfY37rjbPCZRnhvvJuQ46htW3VCAWziVB991P79h6WSv6', process.cwd() + '/test/test-data/badconfig']) .run((err, stdout, exitcode) => { expect(err).to.not.exist expect(exitcode).to.equal(0) diff --git a/tests/test-cli/test-version.js b/test/cli-tests/test-version.js similarity index 100% rename from tests/test-cli/test-version.js rename to test/cli-tests/test-version.js diff --git a/tests/test-core/browser.js b/test/core-tests/browser.js similarity index 95% rename from tests/test-core/browser.js rename to test/core-tests/browser.js index 0ae765a540..9befdbf20b 100644 --- a/tests/test-core/browser.js +++ b/test/core-tests/browser.js @@ -4,7 +4,7 @@ const async = require('async') const store = require('idb-plus-blob-store') const _ = require('lodash') -const repoContext = require.context('buffer!./../repo-example', true) +const repoContext = require.context('buffer!./../go-ipfs-repo', true) const idb = window.indexedDB || window.mozIndexedDB || diff --git a/tests/test-core/index.js b/test/core-tests/index.js similarity index 85% rename from tests/test-core/index.js rename to test/core-tests/index.js index ba0c3159ca..b117395cd0 100644 --- a/tests/test-core/index.js +++ b/test/core-tests/index.js @@ -6,8 +6,8 @@ const rimraf = require('rimraf') const expect = require('chai').expect describe('core', () => { - const repoExample = process.cwd() + '/tests/repo-example' - const repoTests = process.cwd() + '/tests/repo-tests-run' + const repoExample = process.cwd() + '/test/go-ipfs-repo' + const repoTests = process.cwd() + '/test/repo-tests-run' before((done) => { ncp(repoExample, repoTests, (err) => { diff --git a/tests/test-core/test-block.js b/test/core-tests/test-block.js similarity index 90% rename from tests/test-core/test-block.js rename to test/core-tests/test-block.js index 025ef99a81..d4b2c26e0f 100644 --- a/tests/test-core/test-block.js +++ b/test/core-tests/test-block.js @@ -9,8 +9,8 @@ const Block = require('ipfs-blocks').Block const isNode = !global.window const fileA = isNode - ? fs.readFileSync(process.cwd() + '/tests/repo-example/blocks/12207028/122070286b9afa6620a66f715c7020d68af3d10e1a497971629c07606bfdb812303d.data') - : require('buffer!./../repo-example/blocks/12207028/122070286b9afa6620a66f715c7020d68af3d10e1a497971629c07606bfdb812303d.data') + ? fs.readFileSync(process.cwd() + '/test/go-ipfs-repo/blocks/12207028/122070286b9afa6620a66f715c7020d68af3d10e1a497971629c07606bfdb812303d.data') + : require('buffer!./../go-ipfs-repo/blocks/12207028/122070286b9afa6620a66f715c7020d68af3d10e1a497971629c07606bfdb812303d.data') // TODO use arrow funtions again when https://github.com/webpack/webpack/issues/1944 is fixed describe('block', function () { diff --git a/tests/test-core/test-bootstrap.js b/test/core-tests/test-bootstrap.js similarity index 100% rename from tests/test-core/test-bootstrap.js rename to test/core-tests/test-bootstrap.js diff --git a/tests/test-core/test-config.js b/test/core-tests/test-config.js similarity index 100% rename from tests/test-core/test-config.js rename to test/core-tests/test-config.js diff --git a/tests/test-core/test-id.js b/test/core-tests/test-id.js similarity index 100% rename from tests/test-core/test-id.js rename to test/core-tests/test-id.js diff --git a/tests/test-core/test-init-node.js b/test/core-tests/test-init-node.js similarity index 71% rename from tests/test-core/test-init-node.js rename to test/core-tests/test-init-node.js index 96feac2ae6..9b49561ccb 100644 --- a/tests/test-core/test-init-node.js +++ b/test/core-tests/test-init-node.js @@ -2,14 +2,25 @@ const expect = require('chai').expect const IPFS = require('../../src/core') -const createTempRepo = require('../temp-repo') +const createTempRepo = require('../utils/temp-repo') -describe('node: init', function () { +describe('init (Node.js specific)', function () { this.timeout(10000) - it('init docs written', (done) => { - var repo = createTempRepo() - const ipfs = new IPFS(repo) + var ipfs + var repo + + beforeEach((done) => { + repo = createTempRepo() + ipfs = new IPFS(repo) + done() + }) + + afterEach((done) => { + repo.teardown(done) + }) + + it('init docs are written', (done) => { ipfs.init({ bits: 64 }, (err) => { expect(err).to.not.exist @@ -18,15 +29,12 @@ describe('node: init', function () { ipfs.object.get(multihash, {}, (err, node) => { expect(err).to.not.exist expect(node.links).to.exist - - repo.teardown(done) + done() }) }) }) it('empty repo', (done) => { - var repo = createTempRepo() - const ipfs = new IPFS(repo) ipfs.init({ bits: 64, emptyRepo: true }, (err) => { expect(err).to.not.exist @@ -34,7 +42,7 @@ describe('node: init', function () { var multihash = new Buffer('12205e7c3ce237f936c76faf625e90f7751a9f5eeb048f59873303c215e9cce87599', 'hex') ipfs.object.get(multihash, {}, (err, node) => { expect(err).to.exist - repo.teardown(done) + done() }) }) }) diff --git a/tests/test-core/test-init.js b/test/core-tests/test-init.js similarity index 97% rename from tests/test-core/test-init.js rename to test/core-tests/test-init.js index 0bb5d543c4..dc708aa135 100644 --- a/tests/test-core/test-init.js +++ b/test/core-tests/test-init.js @@ -2,7 +2,7 @@ const expect = require('chai').expect const IPFS = require('../../src/core') -const createTempRepo = require('../temp-repo') +const createTempRepo = require('../utils/temp-repo') describe('init', function () { this.timeout(10000) diff --git a/tests/test-core/test-object.js b/test/core-tests/test-object.js similarity index 100% rename from tests/test-core/test-object.js rename to test/core-tests/test-object.js diff --git a/tests/test-core/test-swarm-browser.js b/test/core-tests/test-swarm-browser.js similarity index 100% rename from tests/test-core/test-swarm-browser.js rename to test/core-tests/test-swarm-browser.js diff --git a/tests/test-core/test-swarm-node.js b/test/core-tests/test-swarm-node.js similarity index 100% rename from tests/test-core/test-swarm-node.js rename to test/core-tests/test-swarm-node.js diff --git a/tests/test-core/test-version.js b/test/core-tests/test-version.js similarity index 100% rename from tests/test-core/test-version.js rename to test/core-tests/test-version.js diff --git a/tests/repo-example/blocks/1220120f/1220120f6af601d46e10b2d2e11ed71c55d25f3042c22501e41d1246e7a1e9d3d8ec.data b/test/go-ipfs-repo/blocks/1220120f/1220120f6af601d46e10b2d2e11ed71c55d25f3042c22501e41d1246e7a1e9d3d8ec.data similarity index 100% rename from tests/repo-example/blocks/1220120f/1220120f6af601d46e10b2d2e11ed71c55d25f3042c22501e41d1246e7a1e9d3d8ec.data rename to test/go-ipfs-repo/blocks/1220120f/1220120f6af601d46e10b2d2e11ed71c55d25f3042c22501e41d1246e7a1e9d3d8ec.data diff --git a/tests/repo-example/blocks/122031d6/122031d6da265092f1b03fec969243fdcf095c1d219356cdf538ffce705a52d5738d.data b/test/go-ipfs-repo/blocks/122031d6/122031d6da265092f1b03fec969243fdcf095c1d219356cdf538ffce705a52d5738d.data similarity index 100% rename from tests/repo-example/blocks/122031d6/122031d6da265092f1b03fec969243fdcf095c1d219356cdf538ffce705a52d5738d.data rename to test/go-ipfs-repo/blocks/122031d6/122031d6da265092f1b03fec969243fdcf095c1d219356cdf538ffce705a52d5738d.data diff --git a/tests/repo-example/blocks/122031e7/122031e7a41c15d03feb8cd793c3348ea3b310512d7767a9abfbd7a928a85e977173.data b/test/go-ipfs-repo/blocks/122031e7/122031e7a41c15d03feb8cd793c3348ea3b310512d7767a9abfbd7a928a85e977173.data similarity index 100% rename from tests/repo-example/blocks/122031e7/122031e7a41c15d03feb8cd793c3348ea3b310512d7767a9abfbd7a928a85e977173.data rename to test/go-ipfs-repo/blocks/122031e7/122031e7a41c15d03feb8cd793c3348ea3b310512d7767a9abfbd7a928a85e977173.data diff --git a/tests/repo-example/blocks/12203628/12203628a4a19525dd84bbbffe132ec0b0d3be3528fbbcc814feb7f2fbf71ca06162.data b/test/go-ipfs-repo/blocks/12203628/12203628a4a19525dd84bbbffe132ec0b0d3be3528fbbcc814feb7f2fbf71ca06162.data similarity index 100% rename from tests/repo-example/blocks/12203628/12203628a4a19525dd84bbbffe132ec0b0d3be3528fbbcc814feb7f2fbf71ca06162.data rename to test/go-ipfs-repo/blocks/12203628/12203628a4a19525dd84bbbffe132ec0b0d3be3528fbbcc814feb7f2fbf71ca06162.data diff --git a/tests/repo-example/blocks/12203aa9/12203aa913048b2ef582d4ee2bf6eccad869e2ae1d9e41a2df4e086fe2e1403e8a5b.data b/test/go-ipfs-repo/blocks/12203aa9/12203aa913048b2ef582d4ee2bf6eccad869e2ae1d9e41a2df4e086fe2e1403e8a5b.data similarity index 100% rename from tests/repo-example/blocks/12203aa9/12203aa913048b2ef582d4ee2bf6eccad869e2ae1d9e41a2df4e086fe2e1403e8a5b.data rename to test/go-ipfs-repo/blocks/12203aa9/12203aa913048b2ef582d4ee2bf6eccad869e2ae1d9e41a2df4e086fe2e1403e8a5b.data diff --git a/tests/repo-example/blocks/122048b2/122048b220016f4051d7dd74315bf1ffcb1454f0dd7ae43df2dde01bef8a8bdae446.data b/test/go-ipfs-repo/blocks/122048b2/122048b220016f4051d7dd74315bf1ffcb1454f0dd7ae43df2dde01bef8a8bdae446.data similarity index 100% rename from tests/repo-example/blocks/122048b2/122048b220016f4051d7dd74315bf1ffcb1454f0dd7ae43df2dde01bef8a8bdae446.data rename to test/go-ipfs-repo/blocks/122048b2/122048b220016f4051d7dd74315bf1ffcb1454f0dd7ae43df2dde01bef8a8bdae446.data diff --git a/tests/repo-example/blocks/12204a5a/12204a5a95586f52e25811cf214677160e64383755a8c5163ba3c053c3b65777ed16.data b/test/go-ipfs-repo/blocks/12204a5a/12204a5a95586f52e25811cf214677160e64383755a8c5163ba3c053c3b65777ed16.data similarity index 100% rename from tests/repo-example/blocks/12204a5a/12204a5a95586f52e25811cf214677160e64383755a8c5163ba3c053c3b65777ed16.data rename to test/go-ipfs-repo/blocks/12204a5a/12204a5a95586f52e25811cf214677160e64383755a8c5163ba3c053c3b65777ed16.data diff --git a/tests/repo-example/blocks/12205200/12205200cc6b6f79e1588480d9f9016ccadfda3d8bc7d2f8cdf302aa51dae8dae9da.data b/test/go-ipfs-repo/blocks/12205200/12205200cc6b6f79e1588480d9f9016ccadfda3d8bc7d2f8cdf302aa51dae8dae9da.data similarity index 100% rename from tests/repo-example/blocks/12205200/12205200cc6b6f79e1588480d9f9016ccadfda3d8bc7d2f8cdf302aa51dae8dae9da.data rename to test/go-ipfs-repo/blocks/12205200/12205200cc6b6f79e1588480d9f9016ccadfda3d8bc7d2f8cdf302aa51dae8dae9da.data diff --git a/tests/repo-example/blocks/122052c6/122052c63c7775396b3f82c639977a7223c2d96a9f70b5fd8b1d513f8c5b69dcaed4.data b/test/go-ipfs-repo/blocks/122052c6/122052c63c7775396b3f82c639977a7223c2d96a9f70b5fd8b1d513f8c5b69dcaed4.data similarity index 100% rename from tests/repo-example/blocks/122052c6/122052c63c7775396b3f82c639977a7223c2d96a9f70b5fd8b1d513f8c5b69dcaed4.data rename to test/go-ipfs-repo/blocks/122052c6/122052c63c7775396b3f82c639977a7223c2d96a9f70b5fd8b1d513f8c5b69dcaed4.data diff --git a/tests/repo-example/blocks/12205994/122059948439065f29619ef41280cbb932be52c56d99c5966b65e0111239f098bbef.data b/test/go-ipfs-repo/blocks/12205994/122059948439065f29619ef41280cbb932be52c56d99c5966b65e0111239f098bbef.data similarity index 100% rename from tests/repo-example/blocks/12205994/122059948439065f29619ef41280cbb932be52c56d99c5966b65e0111239f098bbef.data rename to test/go-ipfs-repo/blocks/12205994/122059948439065f29619ef41280cbb932be52c56d99c5966b65e0111239f098bbef.data diff --git a/tests/repo-example/blocks/122062ce/122062ce1f2c91a13a97b596e873b5a3346a644605d7614dca53cd3a59f7385a8abb.data b/test/go-ipfs-repo/blocks/122062ce/122062ce1f2c91a13a97b596e873b5a3346a644605d7614dca53cd3a59f7385a8abb.data similarity index 100% rename from tests/repo-example/blocks/122062ce/122062ce1f2c91a13a97b596e873b5a3346a644605d7614dca53cd3a59f7385a8abb.data rename to test/go-ipfs-repo/blocks/122062ce/122062ce1f2c91a13a97b596e873b5a3346a644605d7614dca53cd3a59f7385a8abb.data diff --git a/tests/repo-example/blocks/12206781/122067817186b8ff365c758f387e3ae7f28fa9367ee167c312e6d65a2e02e81ab815.data b/test/go-ipfs-repo/blocks/12206781/122067817186b8ff365c758f387e3ae7f28fa9367ee167c312e6d65a2e02e81ab815.data similarity index 100% rename from tests/repo-example/blocks/12206781/122067817186b8ff365c758f387e3ae7f28fa9367ee167c312e6d65a2e02e81ab815.data rename to test/go-ipfs-repo/blocks/12206781/122067817186b8ff365c758f387e3ae7f28fa9367ee167c312e6d65a2e02e81ab815.data diff --git a/tests/repo-example/blocks/12207028/122070286b9afa6620a66f715c7020d68af3d10e1a497971629c07606bfdb812303d.data b/test/go-ipfs-repo/blocks/12207028/122070286b9afa6620a66f715c7020d68af3d10e1a497971629c07606bfdb812303d.data similarity index 100% rename from tests/repo-example/blocks/12207028/122070286b9afa6620a66f715c7020d68af3d10e1a497971629c07606bfdb812303d.data rename to test/go-ipfs-repo/blocks/12207028/122070286b9afa6620a66f715c7020d68af3d10e1a497971629c07606bfdb812303d.data diff --git a/tests/repo-example/blocks/1220709b/1220709b2dcc5f6a90ad64d6fe3a5d202a72b057d1c7f2e682d0776a5363e2cca974.data b/test/go-ipfs-repo/blocks/1220709b/1220709b2dcc5f6a90ad64d6fe3a5d202a72b057d1c7f2e682d0776a5363e2cca974.data similarity index 100% rename from tests/repo-example/blocks/1220709b/1220709b2dcc5f6a90ad64d6fe3a5d202a72b057d1c7f2e682d0776a5363e2cca974.data rename to test/go-ipfs-repo/blocks/1220709b/1220709b2dcc5f6a90ad64d6fe3a5d202a72b057d1c7f2e682d0776a5363e2cca974.data diff --git a/tests/repo-example/blocks/122077d2/122077d2a2b0fc907805a547ea83dc99acff7d5806c086068cad8d9e820dd2f4795a.data b/test/go-ipfs-repo/blocks/122077d2/122077d2a2b0fc907805a547ea83dc99acff7d5806c086068cad8d9e820dd2f4795a.data similarity index 100% rename from tests/repo-example/blocks/122077d2/122077d2a2b0fc907805a547ea83dc99acff7d5806c086068cad8d9e820dd2f4795a.data rename to test/go-ipfs-repo/blocks/122077d2/122077d2a2b0fc907805a547ea83dc99acff7d5806c086068cad8d9e820dd2f4795a.data diff --git a/tests/repo-example/blocks/12207fb8/12207fb898b5d7be46d85feb75d894e16cfa9a7ae5533f8e997cdab2ebadd7506340.data b/test/go-ipfs-repo/blocks/12207fb8/12207fb898b5d7be46d85feb75d894e16cfa9a7ae5533f8e997cdab2ebadd7506340.data similarity index 100% rename from tests/repo-example/blocks/12207fb8/12207fb898b5d7be46d85feb75d894e16cfa9a7ae5533f8e997cdab2ebadd7506340.data rename to test/go-ipfs-repo/blocks/12207fb8/12207fb898b5d7be46d85feb75d894e16cfa9a7ae5533f8e997cdab2ebadd7506340.data diff --git a/tests/repo-example/blocks/12208b87/12208b872ca4ee517608331696dd6b3e5cf3497a7845ee8f94456ccf4d1d2f6602b5.data b/test/go-ipfs-repo/blocks/12208b87/12208b872ca4ee517608331696dd6b3e5cf3497a7845ee8f94456ccf4d1d2f6602b5.data similarity index 100% rename from tests/repo-example/blocks/12208b87/12208b872ca4ee517608331696dd6b3e5cf3497a7845ee8f94456ccf4d1d2f6602b5.data rename to test/go-ipfs-repo/blocks/12208b87/12208b872ca4ee517608331696dd6b3e5cf3497a7845ee8f94456ccf4d1d2f6602b5.data diff --git a/tests/repo-example/blocks/122090c0/122090c07a7795c1193510a696d1fdfc0f1e4947cff8e422610996e609dbcb976598.data b/test/go-ipfs-repo/blocks/122090c0/122090c07a7795c1193510a696d1fdfc0f1e4947cff8e422610996e609dbcb976598.data similarity index 100% rename from tests/repo-example/blocks/122090c0/122090c07a7795c1193510a696d1fdfc0f1e4947cff8e422610996e609dbcb976598.data rename to test/go-ipfs-repo/blocks/122090c0/122090c07a7795c1193510a696d1fdfc0f1e4947cff8e422610996e609dbcb976598.data diff --git a/tests/repo-example/blocks/1220929a/1220929a303c39da8a0b67c09697462f687a00c638bcb580feae06452e0c1f20b4.data b/test/go-ipfs-repo/blocks/1220929a/1220929a303c39da8a0b67c09697462f687a00c638bcb580feae06452e0c1f20b4.data similarity index 100% rename from tests/repo-example/blocks/1220929a/1220929a303c39da8a0b67c09697462f687a00c638bcb580feae06452e0c1f20b4.data rename to test/go-ipfs-repo/blocks/1220929a/1220929a303c39da8a0b67c09697462f687a00c638bcb580feae06452e0c1f20b4.data diff --git a/tests/repo-example/blocks/1220933b/1220933b41d37fd4508cdff45930dff56baef91c7dc345e73d049ab570abe10dfbb9.data b/test/go-ipfs-repo/blocks/1220933b/1220933b41d37fd4508cdff45930dff56baef91c7dc345e73d049ab570abe10dfbb9.data similarity index 100% rename from tests/repo-example/blocks/1220933b/1220933b41d37fd4508cdff45930dff56baef91c7dc345e73d049ab570abe10dfbb9.data rename to test/go-ipfs-repo/blocks/1220933b/1220933b41d37fd4508cdff45930dff56baef91c7dc345e73d049ab570abe10dfbb9.data diff --git a/tests/repo-example/blocks/12209d6c/12209d6c2be50f706953479ab9df2ce3edca90b68053c00b3004b7f0accbe1e8eedf.data b/test/go-ipfs-repo/blocks/12209d6c/12209d6c2be50f706953479ab9df2ce3edca90b68053c00b3004b7f0accbe1e8eedf.data similarity index 100% rename from tests/repo-example/blocks/12209d6c/12209d6c2be50f706953479ab9df2ce3edca90b68053c00b3004b7f0accbe1e8eedf.data rename to test/go-ipfs-repo/blocks/12209d6c/12209d6c2be50f706953479ab9df2ce3edca90b68053c00b3004b7f0accbe1e8eedf.data diff --git a/tests/repo-example/blocks/1220a52c/1220a52c3602030cb912edfe4de97002fdadf9d45666c3be122a2efb5db93c1d5fa6.data b/test/go-ipfs-repo/blocks/1220a52c/1220a52c3602030cb912edfe4de97002fdadf9d45666c3be122a2efb5db93c1d5fa6.data similarity index 100% rename from tests/repo-example/blocks/1220a52c/1220a52c3602030cb912edfe4de97002fdadf9d45666c3be122a2efb5db93c1d5fa6.data rename to test/go-ipfs-repo/blocks/1220a52c/1220a52c3602030cb912edfe4de97002fdadf9d45666c3be122a2efb5db93c1d5fa6.data diff --git a/tests/repo-example/blocks/1220b0ab/1220b0abba9f487a9f38ed23337532da45448e0cd0e21ec6a5dec62a51c54b4d51d1.data b/test/go-ipfs-repo/blocks/1220b0ab/1220b0abba9f487a9f38ed23337532da45448e0cd0e21ec6a5dec62a51c54b4d51d1.data similarity index 100% rename from tests/repo-example/blocks/1220b0ab/1220b0abba9f487a9f38ed23337532da45448e0cd0e21ec6a5dec62a51c54b4d51d1.data rename to test/go-ipfs-repo/blocks/1220b0ab/1220b0abba9f487a9f38ed23337532da45448e0cd0e21ec6a5dec62a51c54b4d51d1.data diff --git a/tests/repo-example/blocks/1220b0cb/1220b0cba7371f11461f77081b947d837cc9a3b80e182ac123bbd427563e8b167c96.data b/test/go-ipfs-repo/blocks/1220b0cb/1220b0cba7371f11461f77081b947d837cc9a3b80e182ac123bbd427563e8b167c96.data similarity index 100% rename from tests/repo-example/blocks/1220b0cb/1220b0cba7371f11461f77081b947d837cc9a3b80e182ac123bbd427563e8b167c96.data rename to test/go-ipfs-repo/blocks/1220b0cb/1220b0cba7371f11461f77081b947d837cc9a3b80e182ac123bbd427563e8b167c96.data diff --git a/tests/repo-example/blocks/1220c0fc/1220c0fc6b49543d7bf04e83d2a5a7cbe72a83e80f9c7bca1abcaa42298a57a33ff5.data b/test/go-ipfs-repo/blocks/1220c0fc/1220c0fc6b49543d7bf04e83d2a5a7cbe72a83e80f9c7bca1abcaa42298a57a33ff5.data similarity index 100% rename from tests/repo-example/blocks/1220c0fc/1220c0fc6b49543d7bf04e83d2a5a7cbe72a83e80f9c7bca1abcaa42298a57a33ff5.data rename to test/go-ipfs-repo/blocks/1220c0fc/1220c0fc6b49543d7bf04e83d2a5a7cbe72a83e80f9c7bca1abcaa42298a57a33ff5.data diff --git a/tests/repo-example/blocks/1220e3b0/1220e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.data b/test/go-ipfs-repo/blocks/1220e3b0/1220e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.data similarity index 100% rename from tests/repo-example/blocks/1220e3b0/1220e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.data rename to test/go-ipfs-repo/blocks/1220e3b0/1220e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.data diff --git a/tests/repo-example/blocks/1220e586/1220e586199640e1a4c63fa38c5434b9e72dc99d23a391d3db5e1e42d00527241671.data b/test/go-ipfs-repo/blocks/1220e586/1220e586199640e1a4c63fa38c5434b9e72dc99d23a391d3db5e1e42d00527241671.data similarity index 100% rename from tests/repo-example/blocks/1220e586/1220e586199640e1a4c63fa38c5434b9e72dc99d23a391d3db5e1e42d00527241671.data rename to test/go-ipfs-repo/blocks/1220e586/1220e586199640e1a4c63fa38c5434b9e72dc99d23a391d3db5e1e42d00527241671.data diff --git a/tests/repo-example/blocks/1220e605/1220e605408ac3f78113ac9a7fd486441317afc9f967abe2aa05e7c641f7bbe98a37.data b/test/go-ipfs-repo/blocks/1220e605/1220e605408ac3f78113ac9a7fd486441317afc9f967abe2aa05e7c641f7bbe98a37.data similarity index 100% rename from tests/repo-example/blocks/1220e605/1220e605408ac3f78113ac9a7fd486441317afc9f967abe2aa05e7c641f7bbe98a37.data rename to test/go-ipfs-repo/blocks/1220e605/1220e605408ac3f78113ac9a7fd486441317afc9f967abe2aa05e7c641f7bbe98a37.data diff --git a/tests/repo-example/blocks/1220e6a0/1220e6a045864ff8569e43e4866c0af807def07b0db2f018808620eb30b980e94011.data b/test/go-ipfs-repo/blocks/1220e6a0/1220e6a045864ff8569e43e4866c0af807def07b0db2f018808620eb30b980e94011.data similarity index 100% rename from tests/repo-example/blocks/1220e6a0/1220e6a045864ff8569e43e4866c0af807def07b0db2f018808620eb30b980e94011.data rename to test/go-ipfs-repo/blocks/1220e6a0/1220e6a045864ff8569e43e4866c0af807def07b0db2f018808620eb30b980e94011.data diff --git a/tests/repo-example/blocks/1220ec5b/1220ec5b533a3218991f4377b8b8c2538b95dd29d31eac6433af0fb6fcd83dd80778.data b/test/go-ipfs-repo/blocks/1220ec5b/1220ec5b533a3218991f4377b8b8c2538b95dd29d31eac6433af0fb6fcd83dd80778.data similarity index 100% rename from tests/repo-example/blocks/1220ec5b/1220ec5b533a3218991f4377b8b8c2538b95dd29d31eac6433af0fb6fcd83dd80778.data rename to test/go-ipfs-repo/blocks/1220ec5b/1220ec5b533a3218991f4377b8b8c2538b95dd29d31eac6433af0fb6fcd83dd80778.data diff --git a/tests/repo-example/blocks/1220f1c1/1220f1c121360796b1c031b0d8b58fd546ab06c601063224601337231b75401a31dd.data b/test/go-ipfs-repo/blocks/1220f1c1/1220f1c121360796b1c031b0d8b58fd546ab06c601063224601337231b75401a31dd.data similarity index 100% rename from tests/repo-example/blocks/1220f1c1/1220f1c121360796b1c031b0d8b58fd546ab06c601063224601337231b75401a31dd.data rename to test/go-ipfs-repo/blocks/1220f1c1/1220f1c121360796b1c031b0d8b58fd546ab06c601063224601337231b75401a31dd.data diff --git a/tests/repo-example/config b/test/go-ipfs-repo/config similarity index 100% rename from tests/repo-example/config rename to test/go-ipfs-repo/config diff --git a/tests/repo-example/datastore/000002.ldb b/test/go-ipfs-repo/datastore/000002.ldb similarity index 100% rename from tests/repo-example/datastore/000002.ldb rename to test/go-ipfs-repo/datastore/000002.ldb diff --git a/tests/repo-example/datastore/000005.ldb b/test/go-ipfs-repo/datastore/000005.ldb similarity index 100% rename from tests/repo-example/datastore/000005.ldb rename to test/go-ipfs-repo/datastore/000005.ldb diff --git a/tests/repo-example/datastore/CURRENT b/test/go-ipfs-repo/datastore/CURRENT similarity index 100% rename from tests/repo-example/datastore/CURRENT rename to test/go-ipfs-repo/datastore/CURRENT diff --git a/tests/repo-example/datastore/LOCK b/test/go-ipfs-repo/datastore/LOCK similarity index 100% rename from tests/repo-example/datastore/LOCK rename to test/go-ipfs-repo/datastore/LOCK diff --git a/tests/repo-example/datastore/LOG b/test/go-ipfs-repo/datastore/LOG similarity index 100% rename from tests/repo-example/datastore/LOG rename to test/go-ipfs-repo/datastore/LOG diff --git a/tests/repo-example/datastore/LOG.old b/test/go-ipfs-repo/datastore/LOG.old similarity index 100% rename from tests/repo-example/datastore/LOG.old rename to test/go-ipfs-repo/datastore/LOG.old diff --git a/tests/repo-example/datastore/MANIFEST-000004 b/test/go-ipfs-repo/datastore/MANIFEST-000004 similarity index 100% rename from tests/repo-example/datastore/MANIFEST-000004 rename to test/go-ipfs-repo/datastore/MANIFEST-000004 diff --git a/tests/repo-example/datastore/MANIFEST-000007 b/test/go-ipfs-repo/datastore/MANIFEST-000007 similarity index 100% rename from tests/repo-example/datastore/MANIFEST-000007 rename to test/go-ipfs-repo/datastore/MANIFEST-000007 diff --git a/tests/repo-example/version b/test/go-ipfs-repo/version similarity index 100% rename from tests/repo-example/version rename to test/go-ipfs-repo/version diff --git a/tests/test-http-api/index.js b/test/http-api-tests/index.js similarity index 87% rename from tests/test-http-api/index.js rename to test/http-api-tests/index.js index b19c7a236d..8f9c46f808 100644 --- a/tests/test-http-api/index.js +++ b/test/http-api-tests/index.js @@ -7,8 +7,8 @@ const ncp = require('ncp').ncp const rimraf = require('rimraf') describe('http api', () => { - const repoExample = process.cwd() + '/tests/repo-example' - const repoTests = process.cwd() + '/tests/repo-tests-run' + const repoExample = process.cwd() + '/test/go-ipfs-repo' + const repoTests = process.cwd() + '/test/repo-tests-run' process.env.IPFS_PATH = repoTests before((done) => { diff --git a/tests/test-http-api/test-block.js b/test/http-api-tests/test-block.js similarity index 100% rename from tests/test-http-api/test-block.js rename to test/http-api-tests/test-block.js diff --git a/tests/test-http-api/test-bootstrap.js b/test/http-api-tests/test-bootstrap.js similarity index 100% rename from tests/test-http-api/test-bootstrap.js rename to test/http-api-tests/test-bootstrap.js diff --git a/tests/test-http-api/test-config.js b/test/http-api-tests/test-config.js similarity index 96% rename from tests/test-http-api/test-config.js rename to test/http-api-tests/test-config.js index d7389f58c9..3ca1bc214f 100644 --- a/tests/test-http-api/test-config.js +++ b/test/http-api-tests/test-config.js @@ -8,8 +8,8 @@ const FormData = require('form-data') const streamToPromise = require('stream-to-promise') describe('config', () => { - const configPath = process.cwd() + '/tests/repo-tests-run/config' - const originalConfigPath = process.cwd() + '/tests/repo-example/config' + const configPath = process.cwd() + '/test/repo-tests-run/config' + const originalConfigPath = process.cwd() + '/test/go-ipfs-repo/config' const updatedConfig = () => JSON.parse(fs.readFileSync(configPath, 'utf8')) const restoreConfig = () => fs.writeFileSync(configPath, fs.readFileSync(originalConfigPath, 'utf8'), 'utf8') @@ -169,7 +169,7 @@ describe('config', () => { it('returns 500 if the config is invalid', (done) => { const form = new FormData() - const filePath = 'tests/badconfig' + const filePath = 'test/test-data/badconfig' form.append('file', fs.createReadStream(filePath)) const headers = form.getHeaders() @@ -188,7 +188,7 @@ describe('config', () => { it('updates value', (done) => { const form = new FormData() - const filePath = 'tests/otherconfig' + const filePath = 'test/test-data/otherconfig' form.append('file', fs.createReadStream(filePath)) const headers = form.getHeaders() const expectedConfig = JSON.parse(fs.readFileSync(filePath, 'utf8')) @@ -311,7 +311,7 @@ describe('config', () => { describe('ipfs.config.replace', () => { it('returns error if the config is invalid', (done) => { - const filePath = 'tests/badconfig' + const filePath = 'test/test-data/badconfig' ctl.config.replace(filePath, (err) => { expect(err).to.exist @@ -320,7 +320,7 @@ describe('config', () => { }) it('updates value', (done) => { - const filePath = 'tests/otherconfig' + const filePath = 'test/test-data/otherconfig' const expectedConfig = JSON.parse(fs.readFileSync(filePath, 'utf8')) ctl.config.replace(filePath, (err) => { diff --git a/tests/test-http-api/test-id.js b/test/http-api-tests/test-id.js similarity index 100% rename from tests/test-http-api/test-id.js rename to test/http-api-tests/test-id.js diff --git a/tests/test-http-api/test-object.js b/test/http-api-tests/test-object.js similarity index 97% rename from tests/test-http-api/test-object.js rename to test/http-api-tests/test-object.js index 9e21b64c20..e614c5b9af 100644 --- a/tests/test-http-api/test-object.js +++ b/test/http-api-tests/test-object.js @@ -102,7 +102,7 @@ describe('object', () => { it('returns 500 if the node is invalid', (done) => { const form = new FormData() - const filePath = 'tests/badnode.json' + const filePath = 'test/test-data/badnode.json' form.append('file', fs.createReadStream(filePath)) const headers = form.getHeaders() @@ -121,7 +121,7 @@ describe('object', () => { it('updates value', (done) => { const form = new FormData() - const filePath = 'tests/node.json' + const filePath = 'test/test-data/node.json' form.append('data', fs.createReadStream(filePath)) const headers = form.getHeaders() const expectedResult = { @@ -298,7 +298,7 @@ describe('object', () => { it('returns 500 for request with invalid key', (done) => { const form = new FormData() - const filePath = 'tests/badconfig' + const filePath = 'test/test-data/badconfig' form.append('file', fs.createReadStream(filePath)) const headers = form.getHeaders() @@ -317,7 +317,7 @@ describe('object', () => { it('updates value', (done) => { const form = new FormData() - const filePath = 'tests/badconfig' + const filePath = 'test/test-data/badconfig' form.append('data', fs.createReadStream(filePath)) const headers = form.getHeaders() const expectedResult = { @@ -371,7 +371,7 @@ describe('object', () => { it('returns 500 for request with invalid key', (done) => { const form = new FormData() - const filePath = 'tests/badconfig' + const filePath = 'test/test-data/badconfig' form.append('file', fs.createReadStream(filePath)) const headers = form.getHeaders() @@ -390,7 +390,7 @@ describe('object', () => { it('updates value', (done) => { const form = new FormData() - const filePath = 'tests/badconfig' + const filePath = 'test/test-data/badconfig' form.append('data', fs.createReadStream(filePath)) const headers = form.getHeaders() const expectedResult = { @@ -585,7 +585,7 @@ describe('object', () => { describe('ipfs.object.put', () => { it('returns error if the node is invalid', (done) => { - const filePath = 'tests/badnode.json' + const filePath = 'test/test-data/badnode.json' ctl.object.put(filePath, 'json', (err) => { expect(err).to.exist @@ -594,7 +594,7 @@ describe('object', () => { }) it('updates value', (done) => { - const filePath = 'tests/node.json' + const filePath = 'test/test-data/node.json' const expectedResult = { Hash: 'QmZZmY4KCu9r3e7M2Pcn46Fc5qbn6NpzaAGaYb22kbfTqm', Links: [{ @@ -713,7 +713,7 @@ describe('object', () => { }) it('returns error for request without data', (done) => { - const filePath = 'tests/badnode.json' + const filePath = 'test/test-data/badnode.json' ctl.object.patch.appendData(null, filePath, (err) => { expect(err).to.exist @@ -723,7 +723,7 @@ describe('object', () => { it('updates value', (done) => { const key = 'QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n' - const filePath = 'tests/badnode.json' + const filePath = 'test/test-data/badnode.json' const expectedResult = { Hash: 'QmfY37rjbPCZRnhvvJuQ46htW3VCAWziVB991P79h6WSv6', Links: [] @@ -755,7 +755,7 @@ describe('object', () => { }) it('returns error for request without data', (done) => { - const filePath = 'tests/badnode.json' + const filePath = 'test/test-data/badnode.json' ctl.object.patch.setData(null, filePath, (err) => { expect(err).to.exist @@ -765,7 +765,7 @@ describe('object', () => { it('updates value', (done) => { const key = 'QmfY37rjbPCZRnhvvJuQ46htW3VCAWziVB991P79h6WSv6' - const filePath = 'tests/badnode.json' + const filePath = 'test/test-data/badnode.json' const expectedResult = { Hash: 'QmfY37rjbPCZRnhvvJuQ46htW3VCAWziVB991P79h6WSv6', Links: [] diff --git a/tests/test-http-api/test-repo.js b/test/http-api-tests/test-repo.js similarity index 100% rename from tests/test-http-api/test-repo.js rename to test/http-api-tests/test-repo.js diff --git a/tests/test-http-api/test-version.js b/test/http-api-tests/test-version.js similarity index 100% rename from tests/test-http-api/test-version.js rename to test/http-api-tests/test-version.js diff --git a/tests/badconfig b/test/test-data/badconfig similarity index 100% rename from tests/badconfig rename to test/test-data/badconfig diff --git a/tests/badnode.json b/test/test-data/badnode.json similarity index 100% rename from tests/badnode.json rename to test/test-data/badnode.json diff --git a/tests/node.json b/test/test-data/node.json similarity index 100% rename from tests/node.json rename to test/test-data/node.json diff --git a/tests/otherconfig b/test/test-data/otherconfig similarity index 100% rename from tests/otherconfig rename to test/test-data/otherconfig diff --git a/tests/temp-repo.js b/test/utils/temp-repo.js similarity index 100% rename from tests/temp-repo.js rename to test/utils/temp-repo.js