chore: Fix types in tests 23/N.

This commit is contained in:
cpojer
2026-02-17 12:23:01 +09:00
parent 8d6e345338
commit cf6cdc74d0
13 changed files with 166 additions and 116 deletions

View File

@@ -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") {