阶段七:完成React feature依赖门禁与旧入口瘦身

This commit is contained in:
Christ committed 2026-08-15 02:31:07 +08:00
1 parent 448713735f
commit 22656c20f1
30 files changed
+1485 -1511

No files matched your search

+11 -1
View File
@@ -16,7 +16,7 @@ import {
getReplyRules, getDefaultReplies, getDefaultReply, updateDefaultReply, deleteDefaultReply, clearDefaultReplyRecords,
getShippingRules,
getShippingRulesPage,
getSystemSettings, getCards, createCard, updateCard, deleteCard, getCardDetails, batchCreateCards, appendCardData,
getSystemSettings, getHealth, getCards, createCard, updateCard, deleteCard, getCardDetails, batchCreateCards, appendCardData,
getValidOrders,
publishItem, recommendPublishCategory, previewItemPublishBatch,
logout,
@@ -56,6 +56,16 @@ test('updateSystemSettings uses one atomic bulk request', async () => {
expect(JSON.parse(fetchMock.mock.calls[0][1].body)).toEqual({ theme_color: 'blue', renewal_log_retention_days: 15 });
});
test('health API exposes build metadata through the request boundary', async () => {
// fetchMock 是健康检查 API 的请求替身。
const fetchMock = vi.fn().mockResolvedValue(jsonResponse({ version: '1.2.3', commit: 'abc123' }));
vi.stubGlobal('fetch', fetchMock);
const controller = new AbortController();
await expect(getHealth({ signal: controller.signal })).resolves.toEqual({ version: '1.2.3', commit: 'abc123' });
expect(fetchMock).toHaveBeenCalledWith('/health', expect.objectContaining({ method: 'GET', signal: expect.any(AbortSignal) }));
});
test('chat APIs preserve account and conversation scope', async () => {
const fetchMock = vi.fn()
.mockResolvedValueOnce(jsonResponse({ sessions: [{ account_id: 'a1', chat_id: 'c1' }] }))
+5
View File
@@ -30,6 +30,11 @@ export const verifySession = async (options?: RequestControlOptions): Promise<{
return get('/api/v1/session', undefined, options);
};
// getHealth 读取服务健康检查和构建版本信息。
export const getHealth = async (options?: RequestControlOptions): Promise<{ version?: string; commit?: string }> => {
return get('/health', undefined, options);
};
export const logout = async (): Promise<ApiResponse> => {
return post('/api/v1/session/logout', {});
};