Files
openclaw/extensions/imessage/src/test-plugin.test.ts
Altay 554bc0a9fd fix(plugins): keep test helpers out of contract barrels (#63311)
Merged via squash.

Prepared head SHA: 769e90c6af
Co-authored-by: altaywtf <9790196+altaywtf@users.noreply.github.com>
Co-authored-by: altaywtf <9790196+altaywtf@users.noreply.github.com>
Reviewed-by: @altaywtf
2026-04-08 22:59:05 +01:00

32 lines
977 B
TypeScript

import { afterEach, beforeEach, describe, expect, it } from "vitest";
import {
listImportedBundledPluginFacadeIds,
resetFacadeRuntimeStateForTest,
} from "../../../src/plugin-sdk/facade-runtime.js";
import { createIMessageTestPlugin } from "./imessage.test-plugin.js";
beforeEach(() => {
resetFacadeRuntimeStateForTest();
});
afterEach(() => {
resetFacadeRuntimeStateForTest();
});
describe("createIMessageTestPlugin", () => {
it("does not load the bundled iMessage facade by default", () => {
expect(listImportedBundledPluginFacadeIds()).toEqual([]);
createIMessageTestPlugin();
expect(listImportedBundledPluginFacadeIds()).toEqual([]);
});
it("normalizes repeated transport prefixes without recursive stack growth", () => {
const plugin = createIMessageTestPlugin();
const prefixedHandle = `${"imessage:".repeat(5000)}+44 20 7946 0958`;
expect(plugin.messaging?.normalizeTarget?.(prefixedHandle)).toBe("+442079460958");
});
});