fix: harden store writes, strict schemas, null cfg
This commit is contained in:
1 parent
46906e3f5b
commit
51aa6e3258
7 files changed
+96
-26
No files matched your search
@@ -78,6 +78,13 @@ describe('store', () => {
|
||||
writeStore(path, [connection])
|
||||
expect(readFileSync(path, 'utf8')).toContain('\n "name": "lab"')
|
||||
})
|
||||
|
||||
it('cleans up the tmp file when rename fails', () => {
|
||||
mkdirSync(path, { recursive: true })
|
||||
expect(() => writeStore(path, [connection])).toThrow()
|
||||
const leftovers = readdirSync(join(dir, 'nested')).filter((f) => f.includes('.tmp'))
|
||||
expect(leftovers).toEqual([])
|
||||
})
|
||||
})
|
||||
|
||||
describe('defaultStorePath', () => {
|
||||
|
||||
Reference in new issue
Block a user