mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 03:28:29 +00:00
chore: Fix types in tests 25/N.
This commit is contained in:
@@ -17,7 +17,7 @@ function createForeignSignalHarness() {
|
||||
}
|
||||
},
|
||||
removeEventListener,
|
||||
} as AbortSignal;
|
||||
} as unknown as AbortSignal;
|
||||
|
||||
return {
|
||||
fakeSignal,
|
||||
@@ -38,7 +38,7 @@ describe("wrapFetchWithAbortSignal", () => {
|
||||
|
||||
await wrapped("https://example.com", { method: "POST", body: "hi" });
|
||||
|
||||
expect(seenInit?.duplex).toBe("half");
|
||||
expect((seenInit as (RequestInit & { duplex?: string }) | undefined)?.duplex).toBe("half");
|
||||
});
|
||||
|
||||
it("converts foreign abort signals to native controllers", async () => {
|
||||
@@ -119,7 +119,7 @@ describe("wrapFetchWithAbortSignal", () => {
|
||||
aborted: false,
|
||||
addEventListener: (_event: string, _handler: () => void) => {},
|
||||
removeEventListener,
|
||||
} as AbortSignal;
|
||||
} as unknown as AbortSignal;
|
||||
|
||||
await expect(wrapped("https://example.com", { signal: fakeSignal })).rejects.toBe(fetchError);
|
||||
expect(removeEventListener).toHaveBeenCalledOnce();
|
||||
@@ -141,7 +141,7 @@ describe("wrapFetchWithAbortSignal", () => {
|
||||
aborted: false,
|
||||
addEventListener: (_event: string, _handler: () => void) => {},
|
||||
removeEventListener,
|
||||
} as AbortSignal;
|
||||
} as unknown as AbortSignal;
|
||||
|
||||
expect(() => wrapped("https://example.com", { signal: fakeSignal })).toThrow(syncError);
|
||||
expect(removeEventListener).toHaveBeenCalledOnce();
|
||||
@@ -157,7 +157,7 @@ describe("wrapFetchWithAbortSignal", () => {
|
||||
aborted: true,
|
||||
addEventListener,
|
||||
removeEventListener,
|
||||
} as AbortSignal;
|
||||
} as unknown as AbortSignal;
|
||||
|
||||
await wrapped("https://example.com", { signal: fakeSignal });
|
||||
|
||||
@@ -177,7 +177,7 @@ describe("wrapFetchWithAbortSignal", () => {
|
||||
const preconnectSpy = vi.fn(function (this: unknown) {
|
||||
return this;
|
||||
});
|
||||
const fetchImpl = vi.fn(async () => ({ ok: true }) as Response) as typeof fetch & {
|
||||
const fetchImpl = vi.fn(async () => ({ ok: true }) as Response) as unknown as typeof fetch & {
|
||||
preconnect: (url: string, init?: { credentials?: RequestCredentials }) => unknown;
|
||||
};
|
||||
fetchImpl.preconnect = preconnectSpy;
|
||||
|
||||
Reference in New Issue
Block a user