完善平台、基准模型、定价规则和实时负载的紧凑查询与滚动展示,并固定关键操作列。 新增管理员任务记录、批量计费结算和用户组限流、额度及模型权限维护能力,同时补充任务脱敏、查询索引与 OpenAPI 契约。 验证:pnpm openapi、Go 全量测试、pnpm lint、pnpm test、pnpm build、gofmt 与差异格式检查均通过。
34 lines
884 B
TypeScript
34 lines
884 B
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { adminTaskAdvancedFilterCount, adminTaskPagination } from './AdminTasksPanel';
|
|
|
|
describe('admin task pagination', () => {
|
|
it('keeps empty results on the first page', () => {
|
|
expect(adminTaskPagination(0, 8, 20)).toEqual({
|
|
totalPages: 1,
|
|
currentPage: 1,
|
|
pageStart: 0,
|
|
pageEnd: 0,
|
|
});
|
|
});
|
|
|
|
it('clamps an out-of-range page to the final partial page', () => {
|
|
expect(adminTaskPagination(41, 99, 20)).toEqual({
|
|
totalPages: 3,
|
|
currentPage: 3,
|
|
pageStart: 41,
|
|
pageEnd: 41,
|
|
});
|
|
});
|
|
});
|
|
|
|
describe('admin task advanced filters', () => {
|
|
it('counts only filters moved into the advanced dialog', () => {
|
|
expect(adminTaskAdvancedFilterCount({
|
|
tenantId: 'tenant-id',
|
|
status: 'failed',
|
|
model: '',
|
|
apiKey: 'ops-key',
|
|
})).toBe(3);
|
|
});
|
|
});
|