Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('defaults - folder missing', () => {
const dir = utils.tmpdir()
expect(
() => new FsStore(dir)
).to.not.throw()
})
it('defaults - folder exists', () => {
const dir = utils.tmpdir()
mkdirp.sync(dir)
expect(
() => new FsStore(dir)
).to.not.throw()
})
it('_encode and _decode', () => {
const dir = utils.tmpdir()
const fs = new FsStore(dir)
expect(
fs._encode(new Key('hello/world'))
).to.eql({
dir: path.join(dir, 'hello'),
file: path.join(dir, 'hello', 'world.data')
})
expect(
fs._decode(fs._encode(new Key('hello/world/test:other')).file)
).to.eql(
new Key('hello/world/test:other')
)
})