功能:完善渠道模型批量操作
支持模型管理批量删除,并在拉取模型时提供全选、取消全选和选择数量提示。 同时保持首屏品牌中立,补充后端原子删除与管理员界面回归测试。
This commit is contained in:
@@ -87,6 +87,13 @@ test("channel model fetch requires explicit selection before import", async () =
|
||||
expect(component).toContain("默认已全选");
|
||||
expect(component).toContain("setFetchPreviewOpen(true)");
|
||||
expect(component).toContain("setSelectedFetchModels(result.models)");
|
||||
expect(component).toContain("已选择 {selectedFetchModels.length} / {fetchPreviewModels.length} 个模型");
|
||||
expect(component).toContain("disabled={importing || allFetchModelsSelected}");
|
||||
expect(component).toContain("onClick={() => setSelectedFetchModels(fetchPreviewModels)}");
|
||||
expect(component).toContain("disabled={importing || selectedFetchModels.length === 0}");
|
||||
expect(component).toContain("onClick={() => setSelectedFetchModels([])}");
|
||||
expect(component).toContain("取消全选");
|
||||
expect(component).toContain("disabled={importing}");
|
||||
expect(component).toContain("importAdminChannelModels(channel.id, selectedFetchModels)");
|
||||
expect(component).toContain("disabled={!selectedFetchModels.length}");
|
||||
expect(component).not.toContain("disabled: alreadyExists");
|
||||
@@ -95,6 +102,22 @@ test("channel model fetch requires explicit selection before import", async () =
|
||||
expect(adminCssSource).toContain("border-color: var(--control-check-fg) !important");
|
||||
});
|
||||
|
||||
test("channel model manager supports bounded atomic batch deletion", async () => {
|
||||
const [componentSource, apiSource] = await Promise.all([Bun.file(new URL("../src/pages/admin/components/channel-model-manager.tsx", import.meta.url)).text(), Bun.file(new URL("../src/services/api/wallet.ts", import.meta.url)).text()]);
|
||||
const component = compactSource(componentSource);
|
||||
|
||||
expect(apiSource).toContain("api.post(`/admin/channels/${encodeURIComponent(channelId)}/models/batch-delete`, { modelIds })");
|
||||
expect(component).toContain("<AdminBatchBar count={selectedModelIds.length}");
|
||||
expect(component).toContain("rowSelection:");
|
||||
expect(component).toContain("selectedRowKeys: selectedModelIds");
|
||||
expect(component).toContain("preserveSelectedRowKeys: true");
|
||||
expect(component).toContain("setSelectedModelIds(next.slice(0, 100))");
|
||||
expect(component).toContain("deleteAdminChannelModels(channel.id, selectedModelIds)");
|
||||
expect(component).toContain("okButtonProps: { danger: true }");
|
||||
expect(component).toContain("本次就不会删除任何模型");
|
||||
expect(component).toContain("批量删除");
|
||||
});
|
||||
|
||||
test("analytics keeps fixed range presets distinct and uses enabled channel models for pricing", async () => {
|
||||
const source = compactSource(await Bun.file(new URL("../src/pages/admin/components/analytics-panel.tsx", import.meta.url)).text());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user