mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-06 17:37:47 +08:00
feat(pool): 支持批量导入 Key 和选择性更新设置
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import {
|
||||
buildPoolKeySettingsPatch,
|
||||
createPoolKeyBatchSettingSelection,
|
||||
createPoolKeyBatchSettingsDraft,
|
||||
validatePoolKeyBatchSettings,
|
||||
} from '../poolKeyBatchSettings'
|
||||
|
||||
describe('pool key batch settings', () => {
|
||||
it('only includes explicitly selected fields', () => {
|
||||
const selection = createPoolKeyBatchSettingSelection()
|
||||
const draft = createPoolKeyBatchSettingsDraft()
|
||||
selection.rpm_limit = true
|
||||
selection.proxy_node_id = true
|
||||
draft.rpm_limit = 800
|
||||
draft.proxy_mode = 'clear'
|
||||
|
||||
expect(buildPoolKeySettingsPatch(selection, draft)).toEqual({
|
||||
rpm_limit: 800,
|
||||
proxy_node_id: null,
|
||||
})
|
||||
})
|
||||
|
||||
it('supports adaptive RPM and unlimited concurrency', () => {
|
||||
const selection = createPoolKeyBatchSettingSelection()
|
||||
const draft = createPoolKeyBatchSettingsDraft()
|
||||
selection.rpm_limit = true
|
||||
selection.concurrent_limit = true
|
||||
|
||||
expect(validatePoolKeyBatchSettings(selection, draft)).toEqual([])
|
||||
expect(buildPoolKeySettingsPatch(selection, draft)).toEqual({
|
||||
rpm_limit: null,
|
||||
concurrent_limit: null,
|
||||
})
|
||||
})
|
||||
|
||||
it('requires a selected field and a proxy node for set mode', () => {
|
||||
const selection = createPoolKeyBatchSettingSelection()
|
||||
const draft = createPoolKeyBatchSettingsDraft()
|
||||
|
||||
expect(validatePoolKeyBatchSettings(selection, draft)).toEqual(['请至少选择一个要修改的设置'])
|
||||
|
||||
selection.proxy_node_id = true
|
||||
expect(validatePoolKeyBatchSettings(selection, draft)).toEqual(['请选择要设置的代理节点'])
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user