fix: harden store writes, strict schemas, null cfg

This commit is contained in:
smartass committed 2026-06-11 23:26:54 +05:00
1 parent 46906e3f5b
commit 51aa6e3258
7 files changed
+96 -26

No files matched your search

+7
View File
@@ -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', () => {