From 5a72a16e58ffd66ca07565fd4c693f007c2973ab Mon Sep 17 00:00:00 2001 From: haad Date: Thu, 9 Mar 2023 08:39:21 +0200 Subject: [PATCH] Test directory existence in persisted key-value store --- test/db/keyvalue-persisted.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/db/keyvalue-persisted.js b/test/db/keyvalue-persisted.js index ecea1a0..8c30f64 100644 --- a/test/db/keyvalue-persisted.js +++ b/test/db/keyvalue-persisted.js @@ -1,4 +1,6 @@ import { deepStrictEqual, strictEqual } from 'assert' +import path from 'path' +import fs from 'fs' import rmrf from 'rimraf' import { copy } from 'fs-extra' import * as IPFS from 'ipfs' @@ -59,6 +61,12 @@ describe('KeyValuePersisted Database', function () { strictEqual(db.type, 'keyvalue') }) + it('creates a directory for the persisted index', async () => { + const expectedPath = path.join('./orbitdb', `./${db.address}`, '/_index') + const directoryExists = fs.existsSync(expectedPath) + strictEqual(directoryExists, true) + }) + it('returns 0 items when it\'s a fresh database', async () => { const all = [] for await (const item of db.iterator()) {