From e4bbfa7c41012329a18fbd378ed715c3dcd3033e Mon Sep 17 00:00:00 2001 From: shamb0t Date: Thu, 21 Nov 2019 14:53:17 +0000 Subject: [PATCH] add reopen tests --- test/v0-open-load.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/v0-open-load.js b/test/v0-open-load.js index 876c5bb..6b3e722 100644 --- a/test/v0-open-load.js +++ b/test/v0-open-load.js @@ -170,6 +170,7 @@ Object.keys(testAPIs).forEach(API => { it('database has the correct access-controller', async () => { assert.equal(db.access.type, 'ipfs') + assert.equal(db.options.accessControllerAddress, '/ipfs/zdpuAsYRtJLLLDibnmxWPzyRGJEqtjmJP27ppKWcLreNGGTFN') assert.strictEqual(db.access.write[0], '*') }) @@ -183,6 +184,16 @@ Object.keys(testAPIs).forEach(API => { assert.equal(newEntries.length, 1) assert.strictEqual(newEntries[0].hash, hash) }) + + it('reopens db after adding new entry', async () => { + await db.close() + db = await orbitdb.open(v1Address, { directory: dbPath2 }) + assert.notEqual(db, null) + await db.load() + assert.equal(db.all.length, 101) + const newEntries = db.all.filter(e => e.v > 1) + assert.equal(newEntries.length, 1) + }) }) }) })