mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-06-29 09:12:31 +00:00
Test directory existence in persisted key-value store
This commit is contained in:
parent
ec3f5cbfa0
commit
5a72a16e58
@ -1,4 +1,6 @@
|
|||||||
import { deepStrictEqual, strictEqual } from 'assert'
|
import { deepStrictEqual, strictEqual } from 'assert'
|
||||||
|
import path from 'path'
|
||||||
|
import fs from 'fs'
|
||||||
import rmrf from 'rimraf'
|
import rmrf from 'rimraf'
|
||||||
import { copy } from 'fs-extra'
|
import { copy } from 'fs-extra'
|
||||||
import * as IPFS from 'ipfs'
|
import * as IPFS from 'ipfs'
|
||||||
@ -59,6 +61,12 @@ describe('KeyValuePersisted Database', function () {
|
|||||||
strictEqual(db.type, 'keyvalue')
|
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 () => {
|
it('returns 0 items when it\'s a fresh database', async () => {
|
||||||
const all = []
|
const all = []
|
||||||
for await (const item of db.iterator()) {
|
for await (const item of db.iterator()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user