fix: sql guard gaps, date tz, timeouts, payload

This commit is contained in:
smartass
2026-06-12 01:37:15 +05:00
parent 783e5bc5b9
commit 1fecb1cce4
14 changed files with 237 additions and 10 deletions
+29
View File
@@ -89,6 +89,35 @@ describe('registry', () => {
expect(() => registry.update('u', { host: '' })).toThrow()
})
it('drops the inherited port when switching engine without a new port', () => {
writeStore(storePath, [conn('switch', { type: 'postgres', port: 5432 })])
const registry = createRegistry({ storePath, env: {} })
const updated = registry.update('switch', { type: 'mysql' })
expect(updated.config.type).toBe('mysql')
expect(updated.config.port).toBeUndefined()
})
it('keeps an explicit port when switching engine', () => {
writeStore(storePath, [conn('switch', { type: 'postgres', port: 5432 })])
const registry = createRegistry({ storePath, env: {} })
const updated = registry.update('switch', { type: 'mysql', port: 3307 })
expect(updated.config.port).toBe(3307)
})
it('clears the port when switching engine with an explicit null', () => {
writeStore(storePath, [conn('switch', { type: 'postgres', port: 5432 })])
const registry = createRegistry({ storePath, env: {} })
const updated = registry.update('switch', { type: 'mysql', port: null })
expect(updated.config.port).toBeUndefined()
})
it('keeps the port when type is unchanged', () => {
writeStore(storePath, [conn('same', { type: 'postgres', port: 5432 })])
const registry = createRegistry({ storePath, env: {} })
const updated = registry.update('same', { readonly: true })
expect(updated.config.port).toBe(5432)
})
it('update can rename unless the new name is taken', () => {
writeStore(storePath, [conn('old-name'), conn('taken')])
const registry = createRegistry({ storePath, env: {} })