test(web): 保存边界回归(F03):分区提交载荷互不夹带
build / build (push) Successful in 1m51s

This commit is contained in:
dev
2026-11-17 15:34:31 +08:00
parent 8a574903a1
commit 33afdb9f11
2 changed files with 94 additions and 23 deletions
+47 -1
View File
@@ -1,6 +1,12 @@
import { renderToStaticMarkup } from 'react-dom/server'
import { describe, expect, it, vi } from 'vitest'
import { SystemSettingsView, ppSourceConnections, visibleSaveMessage } from './SystemSettings'
import {
SystemSettingsView,
ppSourceConnections,
refreshSettingsInput,
serviceSettingsInput,
visibleSaveMessage,
} from './SystemSettings'
import { AuthContext } from './auth'
import type { MonitorOverview } from './monitor'
import type { CatalogSource } from './sourceCatalog'
@@ -641,3 +647,43 @@ describe('ppSourceConnections(数据源配置的清单规则)', () => {
expect(ppSourceConnections([])).toEqual([])
})
})
// F03 回归:分区保存不能夹带另一分区未保存的草稿。
describe('保存边界(F03)', () => {
const server = {
document_refresh_seconds: 15,
resource_refresh_seconds: 30,
stalled_after_seconds: 1800,
finalizing_after_seconds: 7200,
ingestion_concurrency: 2,
test_weknora_base_url: 'https://server.test',
production_weknora_base_url: 'https://server.prod',
production_tenant_id: '10000',
production_knowledge_base_id: 'kb-server',
} as unknown as UISettings
it('保存刷新策略时忽略服务分区里未保存的地址', () => {
const input = refreshSettingsInput(server, {
documentRefresh: 60,
resourceRefresh: 60,
stalled: 3600,
finalizing: 14400,
concurrency: 4,
})
expect(input.test_weknora_base_url).toBe('https://server.test')
expect(input.production_weknora_base_url).toBe('https://server.prod')
expect(input.document_refresh_seconds).toBe(60)
})
it('保存服务配置时忽略刷新分区里未保存的参数', () => {
const input = serviceSettingsInput(server, {
testEndpoint: 'https://draft.test',
endpoint: 'https://draft.prod',
productionTenantID: '20000',
productionKnowledgeBaseID: 'kb-draft',
})
expect(input.document_refresh_seconds).toBe(15)
expect(input.ingestion_concurrency).toBe(2)
expect(input.test_weknora_base_url).toBe('https://draft.test')
})
})