mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-30 11:21:07 +00:00
fix: harden mcp channel bridge smoke
This commit is contained in:
@@ -10,6 +10,14 @@ describe("shared/chat-message-content", () => {
|
||||
).toBe("hello");
|
||||
});
|
||||
|
||||
it("returns plain string content", () => {
|
||||
expect(
|
||||
extractFirstTextBlock({
|
||||
content: "hello from string content",
|
||||
}),
|
||||
).toBe("hello from string content");
|
||||
});
|
||||
|
||||
it("preserves empty-string text in the first block", () => {
|
||||
expect(
|
||||
extractFirstTextBlock({
|
||||
|
||||
@@ -3,6 +3,9 @@ export function extractFirstTextBlock(message: unknown): string | undefined {
|
||||
return undefined;
|
||||
}
|
||||
const content = (message as { content?: unknown }).content;
|
||||
if (typeof content === "string") {
|
||||
return content;
|
||||
}
|
||||
if (!Array.isArray(content) || content.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user