优化
This commit is contained in:
@@ -12,6 +12,11 @@ vi.mock('@/shared/api/http', async () => {
|
||||
|
||||
describe('inbound fee-detail API', () => {
|
||||
beforeEach(() => vi.clearAllMocks())
|
||||
it.each(['', ' ', 'null', 'undefined'])('rejects invalid inboundId %j without issuing HTTP', async (inboundId) => {
|
||||
await expect(listInboundFeeDetails('100', inboundId)).rejects.toThrow('inboundId is required')
|
||||
expect(http.get).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('maps the complete write contract and optimistic version', async () => {
|
||||
const payload: SaveInboundFeeDetailRequest = { feeItemId: '31', direction: 'PAYABLE', businessDate: '2026-08-12', unitPrice: 12.5, currency: 'CNY', amount: 125, settlementIncluded: true, partnerId: '41', partnerName: '测试供应商', remark: '验收' }
|
||||
vi.mocked(http.get).mockResolvedValue({ code: '200', message: 'success', data: [] })
|
||||
|
||||
@@ -50,7 +50,11 @@ export interface InboundFeeItemOption {
|
||||
|
||||
export interface InboundFeePartnerOption { id: string | number; partnerName: string }
|
||||
|
||||
function basePath(inboundId: string) { return `/platform/v1/inbounds/${encodeURIComponent(inboundId)}/fee-details` }
|
||||
function basePath(inboundId: string) {
|
||||
const identifier = String(inboundId ?? '').trim()
|
||||
if (!identifier || identifier === 'null' || identifier === 'undefined') throw new TypeError('inboundId is required')
|
||||
return `/platform/v1/inbounds/${encodeURIComponent(identifier)}/fee-details`
|
||||
}
|
||||
const config = (accountId: string) => ({ params: { accountId } })
|
||||
|
||||
export async function listInboundFeeDetails(accountId: string, inboundId: string) {
|
||||
|
||||
Reference in New Issue
Block a user