优化
This commit is contained in:
@@ -17,6 +17,21 @@ describe('platform audit api', () => {
|
||||
|
||||
expect(http.get).toHaveBeenCalledWith('/platform/v1/audit/logs', { params: { accountId: '8', page: 1, size: 20 } })
|
||||
expect(result.records[0].id).toBe('2082813911786024961')
|
||||
expect(result.total).toBe(1)
|
||||
expect(result.pages).toBe(1)
|
||||
})
|
||||
|
||||
it('preserves the server total when the current page has fewer records', async () => {
|
||||
vi.mocked(http.get).mockResolvedValue({ data: {
|
||||
records: [{ id: '1', accountId: '8', operatorTenantId: '0', userId: '9', resourceId: '8', eventId: 'evt', eventType: 'PLATFORM_TENANT_UPDATE', resourceType: 'TENANT', description: '编辑客户', username: 'admin', appCode: 'ADMIN', clientType: 'WEB', requestId: null, traceId: null, serviceName: 'iam-service', success: true, errorCode: null, errorMessage: null, occurredAt: '2026-08-13T01:00:00Z', createdAt: '2026-08-13T09:00:00' }],
|
||||
page: 1, size: 20, total: 13, pages: 1,
|
||||
} })
|
||||
|
||||
const result = await listPlatformAuditLogs({ accountId: '8', page: 1, size: 20 })
|
||||
|
||||
expect(result.records).toHaveLength(1)
|
||||
expect(result.total).toBe(13)
|
||||
expect(result.pages).toBe(1)
|
||||
})
|
||||
|
||||
it('maps audit filters and omits empty query values', async () => {
|
||||
|
||||
@@ -28,6 +28,13 @@ describe('CustomerAuditLogsPanel', () => {
|
||||
expect(wrapper.text()).toContain('编辑客户')
|
||||
})
|
||||
|
||||
it('shows the server total instead of the current page row count', async () => {
|
||||
vi.mocked(listPlatformAuditLogs).mockResolvedValue({ records: [row], page: 1, size: 20, total: 13, pages: 1 })
|
||||
const wrapper = mountPanel(['platform:audit:list']); await flushPromises()
|
||||
|
||||
expect(wrapper.text()).toContain('共 13 条客户操作记录')
|
||||
})
|
||||
|
||||
it('applies keyword, result and local date range only after search', async () => {
|
||||
const wrapper = mountPanel(['platform:audit:list']); await flushPromises()
|
||||
vi.mocked(listPlatformAuditLogs).mockClear()
|
||||
|
||||
Reference in New Issue
Block a user