mirror of
http://192.168.0.88:13333/lywsvip/openclaw-zero-token.git
synced 2026-05-30 21:50:19 +08:00
Major upgrade from e26988a38 to upstream v2026.3.28 (f9b107928).
Key changes:
- Upstream src/, ui/, extensions/ (89 bundled extensions)
- Zero-token web providers preserved in src/zero-token/
- AskOnce plugin restored and registered as CLI command
- Added missing packages: @anthropic-ai/vertex-sdk, @modelcontextprotocol/sdk
- Fixed tsconfig rootDir, skipLibCheck for plugin-sdk DTS build
- Added askonce to bundled plugin metadata and package.json exports
- Fixed AskOnce CLI command registration (missing commands metadata)
- Restored AskOnce adapter imports (correct 5-level relative paths)
- Removed stale migration artifacts from root directory
37 lines
1.6 KiB
TypeScript
37 lines
1.6 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { markdownToWhatsApp } from "./whatsapp.js";
|
|
|
|
describe("markdownToWhatsApp", () => {
|
|
it.each([
|
|
["converts **bold** to *bold*", "**SOD Blast:**", "*SOD Blast:*"],
|
|
["converts __bold__ to *bold*", "__important__", "*important*"],
|
|
["converts ~~strikethrough~~ to ~strikethrough~", "~~deleted~~", "~deleted~"],
|
|
["leaves single *italic* unchanged (already WhatsApp bold)", "*text*", "*text*"],
|
|
["leaves _italic_ unchanged (already WhatsApp italic)", "_text_", "_text_"],
|
|
["preserves inline code", "Use `**not bold**` here", "Use `**not bold**` here"],
|
|
[
|
|
"handles mixed formatting",
|
|
"**bold** and ~~strike~~ and _italic_",
|
|
"*bold* and ~strike~ and _italic_",
|
|
],
|
|
["handles multiple bold segments", "**one** then **two**", "*one* then *two*"],
|
|
["returns empty string for empty input", "", ""],
|
|
["returns plain text unchanged", "no formatting here", "no formatting here"],
|
|
["handles bold inside a sentence", "This is **very** important", "This is *very* important"],
|
|
] as const)("handles markdown-to-whatsapp conversion: %s", (_name, input, expected) => {
|
|
expect(markdownToWhatsApp(input)).toBe(expected);
|
|
});
|
|
|
|
it("preserves fenced code blocks", () => {
|
|
const input = "```\nconst x = **bold**;\n```";
|
|
expect(markdownToWhatsApp(input)).toBe(input);
|
|
});
|
|
|
|
it("preserves code block with formatting inside", () => {
|
|
const input = "Before ```**bold** and ~~strike~~``` after **real bold**";
|
|
expect(markdownToWhatsApp(input)).toBe(
|
|
"Before ```**bold** and ~~strike~~``` after *real bold*",
|
|
);
|
|
});
|
|
});
|