mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-18 04:31:10 +00:00
* honor localhost private-network policy * drop flaky monitor private-network test * align mocks and imports * preserve account private-network overrides * keep default account config * strip stale private-network aliases * fix(bluebubbles): remove unused channel imports * fix: add changelog for bluebubbles private-network opt-out landing (#59373) (thanks @jpreagan) --------- Co-authored-by: Shadow <hi@shadowing.dev>
81 lines
2.2 KiB
TypeScript
81 lines
2.2 KiB
TypeScript
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
|
import type { OpenClawConfig } from "./runtime-api.js";
|
|
|
|
const probeBlueBubblesMock = vi.hoisted(() => vi.fn());
|
|
const cfg: OpenClawConfig = {};
|
|
|
|
vi.mock("./channel.runtime.js", () => ({
|
|
blueBubblesChannelRuntime: {
|
|
probeBlueBubbles: probeBlueBubblesMock,
|
|
},
|
|
}));
|
|
|
|
vi.mock("../../../src/channels/plugins/bundled.js", () => ({
|
|
bundledChannelPlugins: [],
|
|
bundledChannelSetupPlugins: [],
|
|
}));
|
|
|
|
let bluebubblesPlugin: typeof import("./channel.js").bluebubblesPlugin;
|
|
|
|
describe("bluebubblesPlugin.status.probeAccount", () => {
|
|
beforeAll(async () => {
|
|
({ bluebubblesPlugin } = await import("./channel.js"));
|
|
});
|
|
|
|
beforeEach(() => {
|
|
probeBlueBubblesMock.mockReset();
|
|
probeBlueBubblesMock.mockResolvedValue({ ok: true, status: 200 });
|
|
});
|
|
|
|
it("auto-enables private-network probes for loopback server URLs", async () => {
|
|
await bluebubblesPlugin.status?.probeAccount?.({
|
|
cfg,
|
|
account: {
|
|
accountId: "default",
|
|
enabled: true,
|
|
configured: true,
|
|
config: {
|
|
serverUrl: "http://localhost:1234",
|
|
password: "test-password",
|
|
},
|
|
baseUrl: "http://localhost:1234",
|
|
},
|
|
timeoutMs: 5000,
|
|
});
|
|
|
|
expect(probeBlueBubblesMock).toHaveBeenCalledWith({
|
|
baseUrl: "http://localhost:1234",
|
|
password: "test-password",
|
|
timeoutMs: 5000,
|
|
allowPrivateNetwork: true,
|
|
});
|
|
});
|
|
|
|
it("respects an explicit private-network opt-out for loopback server URLs", async () => {
|
|
await bluebubblesPlugin.status?.probeAccount?.({
|
|
cfg,
|
|
account: {
|
|
accountId: "default",
|
|
enabled: true,
|
|
configured: true,
|
|
config: {
|
|
serverUrl: "http://localhost:1234",
|
|
password: "test-password",
|
|
network: {
|
|
dangerouslyAllowPrivateNetwork: false,
|
|
},
|
|
},
|
|
baseUrl: "http://localhost:1234",
|
|
},
|
|
timeoutMs: 5000,
|
|
});
|
|
|
|
expect(probeBlueBubblesMock).toHaveBeenCalledWith({
|
|
baseUrl: "http://localhost:1234",
|
|
password: "test-password",
|
|
timeoutMs: 5000,
|
|
allowPrivateNetwork: false,
|
|
});
|
|
});
|
|
});
|