openclaw/extensions/signal/src/format.links.test.ts
scoootscooob 4540c6b3bc
refactor(signal): move Signal channel code to extensions/signal/src/ (#45531)
Move all Signal channel implementation files from src/signal/ to
extensions/signal/src/ and replace originals with re-export shims.
This continues the channel plugin migration pattern used by other
extensions, keeping backward compatibility via shims while the real
code lives in the extension.

- Copy 32 .ts files (source + tests) to extensions/signal/src/
- Transform all relative import paths for the new location
- Create 2-line re-export shims in src/signal/ for each moved file
- Preserve existing extension files (channel.ts, runtime.ts, etc.)
- Change tsconfig.plugin-sdk.dts.json rootDir from "src" to "."
  to support cross-boundary re-exports from extensions/
2026-03-14 02:42:48 -07:00

36 lines
1.7 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { markdownToSignalText } from "./format.js";
describe("markdownToSignalText", () => {
describe("duplicate URL display", () => {
it("does not duplicate URL for normalized equivalent labels", () => {
const equivalentCases = [
{ input: "[selfh.st](http://selfh.st)", expected: "selfh.st" },
{ input: "[example.com](https://example.com)", expected: "example.com" },
{ input: "[www.example.com](https://example.com)", expected: "www.example.com" },
{ input: "[example.com](https://example.com/)", expected: "example.com" },
{ input: "[example.com](https://example.com///)", expected: "example.com" },
{ input: "[example.com](https://www.example.com)", expected: "example.com" },
{ input: "[EXAMPLE.COM](https://example.com)", expected: "EXAMPLE.COM" },
{ input: "[example.com/page](https://example.com/page)", expected: "example.com/page" },
] as const;
for (const { input, expected } of equivalentCases) {
const res = markdownToSignalText(input);
expect(res.text).toBe(expected);
}
});
it("still shows URL when label is meaningfully different", () => {
const res = markdownToSignalText("[click here](https://example.com)");
expect(res.text).toBe("click here (https://example.com)");
});
it("handles URL with path - should show URL when label is just domain", () => {
// Label is just domain, URL has path - these are meaningfully different
const res = markdownToSignalText("[example.com](https://example.com/page)");
expect(res.text).toBe("example.com (https://example.com/page)");
});
});
});