feat: 完成模板目录导入与生命周期管理
This commit is contained in:
1 parent
553a07c4ec
commit
413413efda
25 files changed
+1313
-24
No files matched your search
@@ -95,3 +95,29 @@ test("小程序上传配置会提交请求地址", async () => {
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
test("模板目录客户端发送分页并支持版本发布和审计", async () => {
|
||||
const calls: Array<{ url: string; method?: string }> = [];
|
||||
const client = new ApiClient({
|
||||
baseUrl: "http://api.test",
|
||||
token: "template-admin-token",
|
||||
fetcher: async (url, init) => {
|
||||
calls.push({ url, method: init?.method });
|
||||
return response(
|
||||
url.includes("/audit")
|
||||
? []
|
||||
: url.endsWith("/publish")
|
||||
? { changed: true, version: { id: "version-1", status: "published" } }
|
||||
: { items: [], page: 2, pageSize: 10, total: 0 },
|
||||
);
|
||||
},
|
||||
});
|
||||
await client.listAdminTemplatePackages({ page: 2, pageSize: 10 });
|
||||
await client.publishAdminTemplatePackage("version/1");
|
||||
await client.listAdminTemplatePackageAudit("version/1");
|
||||
assert.deepEqual(calls, [
|
||||
{ url: "http://api.test/admin/templates?page=2&pageSize=10", method: "GET" },
|
||||
{ url: "http://api.test/admin/templates/version%2F1/publish", method: "POST" },
|
||||
{ url: "http://api.test/admin/templates/version%2F1/audit", method: "GET" },
|
||||
]);
|
||||
});
|
||||
Reference in new issue
Block a user