mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-08-05 13:27:55 +08:00
✨ feat(connection): 新增生产连接只读保护
This commit is contained in:
@@ -240,6 +240,27 @@ describe('dataSourceCapabilities', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('forces supported SQL connections marked read-only into query-only mode', () => {
|
||||
expect(getDataSourceCapabilities({ type: 'postgres', readOnly: true })).toMatchObject({
|
||||
type: 'postgres',
|
||||
supportsCreateDatabase: false,
|
||||
supportsRenameDatabase: false,
|
||||
supportsDropDatabase: false,
|
||||
supportsMessagePublish: false,
|
||||
forceReadOnlyQueryResult: true,
|
||||
});
|
||||
});
|
||||
|
||||
it('ignores readOnly for datasource types that do not support connection-level production guard', () => {
|
||||
expect(getDataSourceCapabilities({ type: 'redis', readOnly: true })).toMatchObject({
|
||||
type: 'redis',
|
||||
supportsQueryEditor: false,
|
||||
supportsCreateDatabase: false,
|
||||
supportsDropDatabase: false,
|
||||
forceReadOnlyQueryResult: false,
|
||||
});
|
||||
});
|
||||
|
||||
it('treats RabbitMQ as a queryable messaging datasource with publish support', () => {
|
||||
expect(getDataSourceCapabilities({ type: 'rabbitmq' })).toMatchObject({
|
||||
type: 'rabbitmq',
|
||||
|
||||
Reference in New Issue
Block a user