style: 统一全仓代码格式

This commit is contained in:
que01 committed 2026-09-19 18:46:26 +08:00
1 parent d811478d0f
commit 8033cabff9
30 files changed
+1183 -187

No files matched your search

+11 -3
View File
@@ -7,7 +7,8 @@ function response(body: unknown, status = 200): FetchResponse {
}
test("客户端发送认证头、查询参数和 JSON 请求体", async () => {
const calls: Array<{ url: string; init?: { headers?: Record<string, string>; body?: string } }> = [];
const calls: Array<{ url: string; init?: { headers?: Record<string, string>; body?: string } }> =
[];
const client = new ApiClient({
baseUrl: "http://api.test/",
token: "token-1",
@@ -18,7 +19,10 @@ test("客户端发送认证头、查询参数和 JSON 请求体", async () => {
});
await client.listAdminBookings({ status: "received", unreadOnly: true, tagId: "tag/1" });
await client.createAdminTag("重点");
assert.equal(calls[0]?.url, "http://api.test/admin/bookings?status=received&unreadOnly=true&tagId=tag%2F1");
assert.equal(
calls[0]?.url,
"http://api.test/admin/bookings?status=received&unreadOnly=true&tagId=tag%2F1",
);
assert.equal(calls[0]?.init?.headers?.authorization, "Bearer token-1");
assert.equal(calls[1]?.init?.body, JSON.stringify({ name: "重点" }));
});
@@ -26,7 +30,11 @@ test("客户端发送认证头、查询参数和 JSON 请求体", async () => {
test("客户端将统一错误响应转换为 ApiClientError", async () => {
const client = new ApiClient({
baseUrl: "http://api.test",
fetcher: async () => response({ data: null, error: { code: "HTTP_401", message: "无权限" }, requestId: "req-1" }, 401),
fetcher: async () =>
response(
{ data: null, error: { code: "HTTP_401", message: "无权限" }, requestId: "req-1" },
401,
),
});
await assert.rejects(
() => client.getAdminUnreadCount(),