chore: Fix more extension test type 1/N.

This commit is contained in:
cpojer
2026-02-17 10:12:14 +09:00
parent 0f8d1f175a
commit 72f00df95a
9 changed files with 75 additions and 26 deletions

View File

@@ -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();

View File

@@ -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;