mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-13 10:11:20 +00:00
test: keep model catalog auth-json tests off provider scans
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import { resetLogger, setLoggerOverride } from "../logging/logger.js";
|
||||
import { resetProviderRuntimeHookCacheForTest } from "../plugins/provider-runtime.js";
|
||||
|
||||
type PiSdkModule = typeof import("./pi-model-discovery.js");
|
||||
|
||||
@@ -11,6 +10,12 @@ let loadModelCatalog: typeof import("./model-catalog.js").loadModelCatalog;
|
||||
let resetModelCatalogCacheForTest: typeof import("./model-catalog.js").resetModelCatalogCacheForTest;
|
||||
let augmentCatalogMock: ReturnType<typeof vi.fn>;
|
||||
|
||||
vi.mock("./model-suppression.runtime.js", () => ({
|
||||
shouldSuppressBuiltInModel: (params: { provider?: string; id?: string }) =>
|
||||
(params.provider === "openai" || params.provider === "azure-openai-responses") &&
|
||||
params.id === "gpt-5.3-codex-spark",
|
||||
}));
|
||||
|
||||
function mockCatalogImportFailThenRecover() {
|
||||
let call = 0;
|
||||
__setModelCatalogImportForTest(async () => {
|
||||
@@ -74,13 +79,11 @@ describe("loadModelCatalog", () => {
|
||||
|
||||
beforeEach(() => {
|
||||
resetModelCatalogCacheForTest();
|
||||
resetProviderRuntimeHookCacheForTest();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
__setModelCatalogImportForTest();
|
||||
resetModelCatalogCacheForTest();
|
||||
resetProviderRuntimeHookCacheForTest();
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
import fs from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { saveAuthProfileStore } from "./auth-profiles.js";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { saveAuthProfileStore } from "./auth-profiles/store.js";
|
||||
import { ensurePiAuthJsonFromAuthProfiles } from "./pi-auth-json.js";
|
||||
|
||||
vi.mock("../plugins/provider-runtime.js", () => ({
|
||||
resolveExternalAuthProfilesWithPlugins: () => [],
|
||||
}));
|
||||
|
||||
type AuthProfileStore = Parameters<typeof saveAuthProfileStore>[0];
|
||||
|
||||
async function createAgentDir() {
|
||||
|
||||
Reference in New Issue
Block a user