test: 修正 mock 的滥用情况

This commit is contained in:
claude-code-best
2026-04-17 10:13:09 +08:00
parent c5ab83a3fc
commit a14b7f352b
15 changed files with 10 additions and 843 deletions

View File

@@ -1,8 +1,5 @@
import { mock, describe, expect, test } from "bun:test";
mock.module("src/utils/slowOperations.js", () => ({
jsonStringify: (v: unknown) => JSON.stringify(v),
}));
mock.module("src/services/analytics/growthbook.js", () => ({
getFeatureValue_CACHED_MAY_BE_STALE: () => false,
}));

View File

@@ -3,12 +3,9 @@ import { mock, describe, expect, test, afterEach } from "bun:test";
mock.module("axios", () => ({
default: { get: async () => ({ data: { servers: [] } }) },
}));
mock.module("src/utils/debug.js", () => ({
mock.module("src/utils/debug.ts", () => ({
logForDebugging: () => {},
}));
mock.module("src/utils/errors.js", () => ({
errorMessage: (e: any) => String(e),
}));
const { isOfficialMcpUrl, resetOfficialMcpUrlsForTesting } = await import(
"../officialRegistry"