mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 07:20:45 +00:00
chore: Fix more extension test type 1/N.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { SsrFBlockedError } from "openclaw/plugin-sdk";
|
||||
import type { LookupFn } from "openclaw/plugin-sdk";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { authenticate } from "./auth.js";
|
||||
|
||||
@@ -31,10 +32,11 @@ describe("tlon urbit auth ssrf", () => {
|
||||
}),
|
||||
});
|
||||
vi.stubGlobal("fetch", mockFetch);
|
||||
const lookupFn = (async () => [{ address: "127.0.0.1", family: 4 }]) as unknown as LookupFn;
|
||||
|
||||
const cookie = await authenticate("http://127.0.0.1:8080", "code", {
|
||||
ssrfPolicy: { allowPrivateNetwork: true },
|
||||
lookupFn: async () => [{ address: "127.0.0.1", family: 4 }],
|
||||
lookupFn,
|
||||
});
|
||||
expect(cookie).toContain("urbauth-~zod=123");
|
||||
expect(mockFetch).toHaveBeenCalled();
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { LookupFn } from "openclaw/plugin-sdk";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { UrbitSSEClient } from "./sse-client.js";
|
||||
|
||||
@@ -15,9 +16,10 @@ describe("UrbitSSEClient", () => {
|
||||
|
||||
it("sends subscriptions added after connect", async () => {
|
||||
mockFetch.mockResolvedValue({ ok: true, status: 200, text: async () => "" });
|
||||
const lookupFn = (async () => [{ address: "1.1.1.1", family: 4 }]) as unknown as LookupFn;
|
||||
|
||||
const client = new UrbitSSEClient("https://example.com", "urbauth-~zod=123", {
|
||||
lookupFn: async () => [{ address: "1.1.1.1", family: 4 }],
|
||||
lookupFn,
|
||||
});
|
||||
(client as { isConnected: boolean }).isConnected = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user