This commit is contained in:
2026-08-05 15:54:59 +08:00
parent eede351038
commit 4b31eb7786
43 changed files with 2117 additions and 851 deletions
@@ -72,6 +72,17 @@ describe('platform warehouse API', () => {
})
})
it('lists all platform warehouses without a customer filter', async () => {
const page = { records: [], page: 1, size: 200, total: 0, pages: 0 }
vi.mocked(http.get).mockResolvedValue({ code: '200', data: page })
await listPlatformWarehouses()
expect(http.get).toHaveBeenCalledWith('/platform/v1/warehouse-admin', {
params: { page: 1, size: 200 },
})
})
it('uses the implemented create, update, and status routes', async () => {
vi.mocked(http.post).mockResolvedValue({ code: '200', message: 'success', data: '19001' })
vi.mocked(http.put).mockResolvedValue({ code: '200', message: 'success', data: null })
@@ -101,9 +101,9 @@ export interface SavePlatformWarehouseRequest {
const basePath = '/platform/v1/warehouse-admin'
export async function listPlatformWarehouses(tenantId: number | string, page = 1, size = 200) {
export async function listPlatformWarehouses(tenantId?: number | string, page = 1, size = 200) {
const response = await http.get<ApiEnvelope<PlatformWarehousePage>, ApiEnvelope<PlatformWarehousePage>>(basePath, {
params: { tenantId, page, size },
params: { ...(tenantId === undefined || tenantId === '' ? {} : { tenantId }), page, size },
})
return unwrapApiResponse(response)
}