mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-08-11 09:13:36 +08:00
- 分组不再覆盖连接自身环境类型,Tab 和侧栏视图统一使用连接环境颜色\n- 为未配置生产保护的生产连接增加 5 秒风险确认,覆盖 SQL、数据、结构、同步、Redis、Nacos 和消息操作\n- 写操作完成后等待刷新请求结束再提示成功,避免界面状态落后于实际结果\n- 增加连接环境、生产风险确认和刷新竞态测试,关联 Issue #823
46 lines
1.3 KiB
TypeScript
46 lines
1.3 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
|
|
import type { SavedConnection } from '../types';
|
|
import {
|
|
getConnectionEnvironmentMeta,
|
|
normalizeConnectionEnvironmentType,
|
|
resolveConnectionEnvironmentPresentation,
|
|
resolveConnectionEnvironmentType,
|
|
} from './connectionEnvironment';
|
|
|
|
const connection: SavedConnection = {
|
|
id: 'conn-1',
|
|
name: 'Orders',
|
|
environmentType: 'development',
|
|
config: {
|
|
id: 'conn-1',
|
|
type: 'mysql',
|
|
host: 'db.local',
|
|
port: 3306,
|
|
user: 'root',
|
|
},
|
|
};
|
|
|
|
describe('connectionEnvironment', () => {
|
|
it('falls back to local for missing and unsupported persisted values', () => {
|
|
expect(normalizeConnectionEnvironmentType(undefined)).toBe('local');
|
|
expect(normalizeConnectionEnvironmentType('unknown')).toBe('local');
|
|
expect(getConnectionEnvironmentMeta(undefined).color).toBe('#8c8c8c');
|
|
});
|
|
|
|
it('uses the connection environment', () => {
|
|
expect(resolveConnectionEnvironmentType(connection)).toBe('development');
|
|
});
|
|
|
|
it('does not let group membership override the connection environment', () => {
|
|
expect(resolveConnectionEnvironmentPresentation(
|
|
connection,
|
|
(key) => key,
|
|
)).toEqual({
|
|
type: 'development',
|
|
color: '#1677ff',
|
|
label: 'connection.environment.development',
|
|
});
|
|
});
|
|
});
|