♻️ refactor(connection): 拆分 MongoDB 连接配置区

- 将 MongoDB 拓扑、SRV、策略和副本集表单拆入独立组件

- 更新连接弹窗源码断言覆盖拆分后的 Mongo 字段

- 已通过前端定向测试、build 和浏览器 Mongo 表单冒烟
This commit is contained in:
Syngnat
2026-06-12 02:58:05 +08:00
parent 8a0dc3a7d3
commit 8f0bd61c14
3 changed files with 397 additions and 303 deletions

View File

@@ -3,7 +3,8 @@ import { readFileSync } from 'node:fs';
const connectionModalSource = readFileSync(new URL('./ConnectionModal.tsx', import.meta.url), 'utf8');
const redisSectionsSource = readFileSync(new URL('./ConnectionModalRedisSections.tsx', import.meta.url), 'utf8');
const source = `${connectionModalSource}\n${redisSectionsSource}`;
const mongoSectionsSource = readFileSync(new URL('./ConnectionModalMongoSections.tsx', import.meta.url), 'utf8');
const source = `${connectionModalSource}\n${redisSectionsSource}\n${mongoSectionsSource}`;
describe('ConnectionModal edit password behavior', () => {
it('keeps the prefilled primary password masked by default', () => {
@@ -51,3 +52,15 @@ describe('ConnectionModal Redis Sentinel configuration', () => {
expect(source).toContain('form.setFieldValue("port", 6379)');
});
});
describe('ConnectionModal MongoDB configuration', () => {
it('keeps replica, SRV, and read preference fields in the split Mongo sections', () => {
expect(source).toContain('ConnectionModalMongoSections');
expect(source).toContain('name="mongoSrv"');
expect(source).toContain('SRV 与 SSH 隧道同时启用');
expect(source).toContain('name="mongoReplicaPassword"');
expect(source).toContain('clearKey: "mongoReplicaPassword"');
expect(source).toContain('自动发现成员');
expect(source).toContain('fieldName: "mongoReadPreference"');
});
});