style(storage,workspace): satisfy the repository lint gate
eslint --fix formatting sweep plus the manual residue: sync method bodies drop async behind Promise-returning signatures (the sqlite unit routes primitives through a settle() guard preserving the never-throws- synchronously contract), catch callbacks type their reason as unknown, loadAll's global slot is plain unknown (null semantics stay in JSDoc), a non-null assertion becomes a narrowing, and unsafe any assignments in tests gain explicit types. One justified eslint-disable for prefer-promise-reject-errors follows the core/session precedent — wrapping would discard the original StorageError code.
This commit is contained in:
@@ -171,6 +171,17 @@ describe('sqlite backend specifics', () => {
|
||||
await reopened.close()
|
||||
})
|
||||
|
||||
it('wraps a non-Error toJSON throw into an Error rejection', async () => {
|
||||
const backend = backendAt(':memory:')
|
||||
const unit = await backend.kv.open(DESCRIPTOR)
|
||||
// JSON.stringify propagates a value's own toJSON throw verbatim; the unit
|
||||
// must still reject with an Error instance.
|
||||
const hostile = { toJSON: () => { throw 'not an error' } }
|
||||
await expect(unit.putRecord('records', 'k', hostile)).rejects.toThrow('not an error')
|
||||
await expect(unit.putRecord('records', 'k', hostile)).rejects.toBeInstanceOf(Error)
|
||||
await backend.close()
|
||||
})
|
||||
|
||||
it('rejects setGlobal on a unit without a global slot and writes to undeclared tables', async () => {
|
||||
const backend = backendAt(':memory:')
|
||||
const unit = await backend.kv.open({ ...DESCRIPTOR, hasGlobal: false })
|
||||
|
||||
Reference in New Issue
Block a user