test: tighten ui controller assertions · openclaw/openclaw@596aa45
steipete
·
2026-05-08
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -13,6 +13,8 @@ import {
|
13 | 13 | type ChatState, |
14 | 14 | } from "./chat.ts"; |
15 | 15 | |
| 16 | +const UUID_V4_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u; |
| 17 | + |
16 | 18 | function createState(overrides: Partial<ChatState> = {}): ChatState { |
17 | 19 | return { |
18 | 20 | chatAttachments: [], |
@@ -864,7 +866,7 @@ describe("sendChatMessage", () => {
|
864 | 866 | await loadChatHistory(state); |
865 | 867 | const result = await sendChatMessage(state, "continue"); |
866 | 868 | |
867 | | -expect(result).toEqual(expect.any(String)); |
| 869 | +expect(result).toMatch(UUID_V4_RE); |
868 | 870 | expect(state.currentSessionId).toBe("session-before-reconnect"); |
869 | 871 | expect(request).toHaveBeenLastCalledWith( |
870 | 872 | "chat.send", |
@@ -892,7 +894,7 @@ describe("sendChatMessage", () => {
|
892 | 894 | }, |
893 | 895 | ]); |
894 | 896 | |
895 | | -expect(result).toEqual(expect.any(String)); |
| 897 | +expect(result).toMatch(UUID_V4_RE); |
896 | 898 | expect(request).toHaveBeenCalledWith( |
897 | 899 | "chat.send", |
898 | 900 | expect.objectContaining({ |
@@ -944,7 +946,7 @@ describe("sendChatMessage", () => {
|
944 | 946 | |
945 | 947 | const result = await sendChatMessage(state, "summarize", [attachment]); |
946 | 948 | |
947 | | -expect(result).toEqual(expect.any(String)); |
| 949 | +expect(result).toMatch(UUID_V4_RE); |
948 | 950 | expect(request).toHaveBeenCalledWith( |
949 | 951 | "chat.send", |
950 | 952 | expect.objectContaining({ |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。