fix(site): 清理经营租户请求中的旧分销参数
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
|
||||
const apiClient = vi.hoisted(() => ({
|
||||
get: vi.fn(),
|
||||
@@ -25,6 +25,11 @@ import {
|
||||
import { fetchAdminPayments } from '@/features/admin/api/adminPayments'
|
||||
|
||||
describe('financial API clients', () => {
|
||||
afterEach(() => {
|
||||
sessionStorage.clear()
|
||||
vi.clearAllMocks()
|
||||
})
|
||||
|
||||
it('fetches wallet balance and paginated ledger with server data', async () => {
|
||||
apiClient.get
|
||||
.mockResolvedValueOnce({ data: { data: { available_balance_cent: 100 } } })
|
||||
@@ -79,6 +84,25 @@ describe('financial API clients', () => {
|
||||
await expect(cancelWithdrawal(9)).resolves.toEqual({ cancelled: true })
|
||||
})
|
||||
|
||||
it('drops explicit legacy site codes from tenant withdrawal payloads', async () => {
|
||||
sessionStorage.setItem('hfb_tenant_code', 'jieyou')
|
||||
apiClient.post.mockResolvedValueOnce({ data: { data: { id: 10 } } })
|
||||
|
||||
await createWithdrawal(
|
||||
{
|
||||
payment_account_id: 7,
|
||||
amount_cent: 1000,
|
||||
distribution_site_code: 'legacy_jieyou',
|
||||
},
|
||||
'legacy_override'
|
||||
)
|
||||
|
||||
expect(apiClient.post).toHaveBeenLastCalledWith('/withdrawals', {
|
||||
payment_account_id: 7,
|
||||
amount_cent: 1000,
|
||||
})
|
||||
})
|
||||
|
||||
it('filters empty admin-payment query values and normalizes pagination', async () => {
|
||||
apiClient.get.mockResolvedValueOnce({ data: { data: undefined } })
|
||||
|
||||
|
||||
Reference in New Issue
Block a user