From 9573ab66c59c3805f0290f1cf20ce576f13eff4b Mon Sep 17 00:00:00 2001 From: shamb0t Date: Thu, 7 Nov 2019 16:13:01 +0000 Subject: [PATCH] use windows-friendly paths in create-open.test --- test/create-open.test.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/test/create-open.test.js b/test/create-open.test.js index ddf861e..52a3de5 100644 --- a/test/create-open.test.js +++ b/test/create-open.test.js @@ -20,10 +20,10 @@ const { testAPIs, } = require('./utils') -const dbPath = './orbitdb/tests/create-open' -const ipfsPath = './orbitdb/tests/create-open/ipfs' -const migrationFixturePath = './test/fixtures/migration/cache-schema-test' -const ipfsFixturesDir = './test/fixtures/ipfs' +const dbPath = path.join(__dirname, 'orbitdb', 'tests', 'create-open') +const ipfsPath = path.join(__dirname, 'orbitdb', 'tests', 'create-open', 'ipfs') +const migrationFixturePath = path.join(__dirname, 'fixtures', 'migration', 'cache-schema-test') +const ipfsFixturesDir = path.join(__dirname, 'fixtures', 'ipfs') Object.keys(testAPIs).forEach(API => { describe(`orbit-db - Create & Open (${API})`, function () { @@ -33,6 +33,12 @@ Object.keys(testAPIs).forEach(API => { let ipfsd, ipfs, orbitdb, db, address let localDataPath + const filterFunc = (src, dest) => { + // windows has problems copying these files... + return !(src.includes('LOG') || src.includes('LOCK')) + } + + before(async () => { config.daemon1.repo = ipfsPath rmrf.sync(config.daemon1.repo) @@ -40,11 +46,6 @@ Object.keys(testAPIs).forEach(API => { ipfsd = await startIpfs(API, config.daemon1) ipfs = ipfsd.api - const filterFunc = (src, dest) => { - // windows has problems copying these files... - return !(src.includes('LOG') || src.includes('LOCK')) - } - await fs.copy(path.join(ipfsFixturesDir, 'blocks'), path.join(ipfsd.path, 'blocks')) await fs.copy(path.join(ipfsFixturesDir, 'datastore'), path.join(ipfsd.path, 'datastore'), { filter: filterFunc }) orbitdb = await OrbitDB.createInstance(ipfs, { directory: dbPath }) @@ -160,7 +161,7 @@ Object.keys(testAPIs).forEach(API => { assert.equal((await db.get('key')), undefined) await db.drop() - await fs.copy(migrationFixturePath, migrationDataPath) + await fs.copy(migrationFixturePath, migrationDataPath, { filter: filterFunc }) db = await orbitdb.create(dbName, 'keyvalue') await db.load() @@ -172,7 +173,7 @@ Object.keys(testAPIs).forEach(API => { const dbName = 'cache-schema-test2' const directory = path.join(dbPath, "some-other-place") - await fs.copy(migrationFixturePath, directory) + await fs.copy(migrationFixturePath, directory, { filter: filterFunc }) db = await orbitdb.create(dbName, 'keyvalue', { directory }) await db.load()