mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-19 06:47:26 +00:00
chore: Fix types in tests 23/N.
This commit is contained in:
@@ -4,6 +4,7 @@ import path from "node:path";
|
||||
import { PassThrough } from "node:stream";
|
||||
import JSZip from "jszip";
|
||||
import { afterAll, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { createPinnedLookup } from "../infra/net/ssrf.js";
|
||||
import { captureEnv } from "../test-utils/env.js";
|
||||
import { saveMediaSource, setMediaStoreNetworkDepsForTest } from "./store.js";
|
||||
|
||||
@@ -24,8 +25,10 @@ describe("media store redirects", () => {
|
||||
setMediaStoreNetworkDepsForTest({
|
||||
httpRequest: (...args) => mockRequest(...args),
|
||||
httpsRequest: (...args) => mockRequest(...args),
|
||||
resolvePinnedHostname: async () => ({
|
||||
lookup: async () => [{ address: "93.184.216.34", family: 4 }],
|
||||
resolvePinnedHostname: async (hostname) => ({
|
||||
hostname,
|
||||
addresses: ["93.184.216.34"],
|
||||
lookup: createPinnedLookup({ hostname, addresses: ["93.184.216.34"] }),
|
||||
}),
|
||||
});
|
||||
});
|
||||
@@ -41,7 +44,10 @@ describe("media store redirects", () => {
|
||||
let call = 0;
|
||||
mockRequest.mockImplementation((_url, _opts, cb) => {
|
||||
call += 1;
|
||||
const res = new PassThrough();
|
||||
const res = Object.assign(new PassThrough(), {
|
||||
statusCode: 0,
|
||||
headers: {} as Record<string, string>,
|
||||
});
|
||||
const req = {
|
||||
on: (event: string, handler: (...args: unknown[]) => void) => {
|
||||
if (event === "error") {
|
||||
@@ -83,7 +89,10 @@ describe("media store redirects", () => {
|
||||
|
||||
it("sniffs xlsx from zip content when headers and url extension are missing", async () => {
|
||||
mockRequest.mockImplementationOnce((_url, _opts, cb) => {
|
||||
const res = new PassThrough();
|
||||
const res = Object.assign(new PassThrough(), {
|
||||
statusCode: 0,
|
||||
headers: {} as Record<string, string>,
|
||||
});
|
||||
const req = {
|
||||
on: (event: string, handler: (...args: unknown[]) => void) => {
|
||||
if (event === "error") {
|
||||
|
||||
Reference in New Issue
Block a user