From c5a1a82223f35492281779f9078334e3a78b31f6 Mon Sep 17 00:00:00 2001 From: KnowSky404 Date: Mon, 27 Apr 2026 18:13:14 +0800 Subject: [PATCH] test: cover missing OpenAI bulk edit fields --- .../__tests__/BulkEditAccountModal.spec.ts | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/frontend/src/components/account/__tests__/BulkEditAccountModal.spec.ts b/frontend/src/components/account/__tests__/BulkEditAccountModal.spec.ts index 2e360978..50d170da 100644 --- a/frontend/src/components/account/__tests__/BulkEditAccountModal.spec.ts +++ b/frontend/src/components/account/__tests__/BulkEditAccountModal.spec.ts @@ -178,6 +178,45 @@ describe('BulkEditAccountModal', () => { expect(wrapper.find('#bulk-edit-openai-ws-mode-enabled').exists()).toBe(false) }) + it('OpenAI OAuth 批量编辑应提交 codex_cli_only 字段', async () => { + const wrapper = mountModal({ + selectedPlatforms: ['openai'], + selectedTypes: ['oauth'] + }) + + await wrapper.get('#bulk-edit-openai-codex-cli-only-enabled').setValue(true) + await wrapper.get('#bulk-edit-openai-codex-cli-only-toggle').trigger('click') + await wrapper.get('#bulk-edit-account-form').trigger('submit.prevent') + await flushPromises() + + expect(adminAPI.accounts.bulkUpdate).toHaveBeenCalledTimes(1) + expect(adminAPI.accounts.bulkUpdate).toHaveBeenCalledWith([1, 2], { + extra: { + codex_cli_only: true + } + }) + }) + + it('OpenAI API Key 批量编辑应提交 API Key 专属 WS mode 字段', async () => { + const wrapper = mountModal({ + selectedPlatforms: ['openai'], + selectedTypes: ['apikey'] + }) + + await wrapper.get('#bulk-edit-openai-apikey-ws-mode-enabled').setValue(true) + await wrapper.get('[data-testid="bulk-edit-openai-apikey-ws-mode-select"]').setValue('ctx_pool') + await wrapper.get('#bulk-edit-account-form').trigger('submit.prevent') + await flushPromises() + + expect(adminAPI.accounts.bulkUpdate).toHaveBeenCalledTimes(1) + expect(adminAPI.accounts.bulkUpdate).toHaveBeenCalledWith([1, 2], { + extra: { + openai_apikey_responses_websockets_v2_mode: 'ctx_pool', + openai_apikey_responses_websockets_v2_enabled: true + } + }) + }) + it('OpenAI 账号批量编辑可关闭自动透传', async () => { const wrapper = mountModal({ selectedPlatforms: ['openai'],