test: cover account bulk edit target scopes

This commit is contained in:
KnowSky404
2026-04-27 18:08:22 +08:00
parent 25c7b0d9f4
commit 764afbe37a
2 changed files with 189 additions and 0 deletions

View File

@@ -217,4 +217,41 @@ describe('BulkEditAccountModal', () => {
})
expect(wrapper.text()).toContain('admin.accounts.openai.modelRestrictionDisabledByPassthrough')
})
it('filtered-results 模式下应提交 filters 而不是 account_ids', async () => {
const wrapper = mountModal({
accountIds: [],
target: {
mode: 'filtered',
filters: {
platform: 'openai',
type: 'oauth',
status: 'active',
group: '12',
search: 'bulk-target',
privacy_mode: 'training_set_cf_blocked'
},
previewCount: 5,
selectedPlatforms: ['openai'],
selectedTypes: ['oauth']
}
})
await wrapper.get('#bulk-edit-status-enabled').setValue(true)
await wrapper.get('#bulk-edit-account-form').trigger('submit.prevent')
await flushPromises()
expect(adminAPI.accounts.bulkUpdate).toHaveBeenCalledTimes(1)
expect(adminAPI.accounts.bulkUpdate).toHaveBeenCalledWith({
filters: {
platform: 'openai',
type: 'oauth',
status: 'active',
group: '12',
search: 'bulk-target',
privacy_mode: 'training_set_cf_blocked'
},
status: 'active'
})
})
})