mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-04 12:50:20 +00:00
test: isolate agentic suite smoke tests
This commit is contained in:
@@ -71,8 +71,19 @@ describe("syncExternalCliCredentials", () => {
|
||||
|
||||
describe("shouldReplaceStoredOAuthCredential", () => {
|
||||
it("keeps equivalent stored credentials", () => {
|
||||
const stored = makeOAuthCredential({ provider: "openai-codex", access: "a", refresh: "r" });
|
||||
const incoming = makeOAuthCredential({ provider: "openai-codex", access: "a", refresh: "r" });
|
||||
const expires = Date.now() + 60_000;
|
||||
const stored = makeOAuthCredential({
|
||||
provider: "openai-codex",
|
||||
access: "a",
|
||||
refresh: "r",
|
||||
expires,
|
||||
});
|
||||
const incoming = makeOAuthCredential({
|
||||
provider: "openai-codex",
|
||||
access: "a",
|
||||
refresh: "r",
|
||||
expires,
|
||||
});
|
||||
|
||||
expect(shouldReplaceStoredOAuthCredential(stored, incoming)).toBe(false);
|
||||
});
|
||||
|
||||
@@ -8,7 +8,7 @@ const isWin = process.platform === "win32";
|
||||
const defaultShell = isWin
|
||||
? undefined
|
||||
: process.env.OPENCLAW_TEST_SHELL || resolveShellFromPath("bash") || process.env.SHELL || "sh";
|
||||
const longDelayCmd = isWin ? "Start-Sleep -Milliseconds 200" : "sleep 0.2";
|
||||
const longDelayCmd = isWin ? "Start-Sleep -Seconds 5" : "sleep 5";
|
||||
|
||||
describe("exec foreground failures", () => {
|
||||
let envSnapshot: ReturnType<typeof captureEnv>;
|
||||
|
||||
@@ -21,10 +21,21 @@ describe("Ollama auto-discovery", () => {
|
||||
delete process.env.OLLAMA_API_KEY;
|
||||
});
|
||||
|
||||
function createCleanProviderDiscoveryEnv(): NodeJS.ProcessEnv {
|
||||
const env = { ...process.env };
|
||||
delete env.OPENCLAW_BUNDLED_PLUGINS_DIR;
|
||||
delete env.OPENCLAW_DISABLE_BUNDLED_PLUGINS;
|
||||
delete env.OPENCLAW_SKIP_PROVIDERS;
|
||||
delete env.OPENCLAW_SKIP_CHANNELS;
|
||||
delete env.OPENCLAW_SKIP_CRON;
|
||||
delete env.OPENCLAW_TEST_MINIMAL_GATEWAY;
|
||||
return env;
|
||||
}
|
||||
|
||||
function createCatalogLoadEnv(): NodeJS.ProcessEnv {
|
||||
originalFetch = globalThis.fetch;
|
||||
return {
|
||||
...process.env,
|
||||
...createCleanProviderDiscoveryEnv(),
|
||||
OPENCLAW_TEST_ONLY_PROVIDER_PLUGIN_IDS: "ollama",
|
||||
VITEST: "1",
|
||||
NODE_ENV: "test",
|
||||
@@ -33,7 +44,7 @@ describe("Ollama auto-discovery", () => {
|
||||
|
||||
function createDiscoveryRunEnv(): NodeJS.ProcessEnv {
|
||||
return {
|
||||
...process.env,
|
||||
...createCleanProviderDiscoveryEnv(),
|
||||
OPENCLAW_TEST_ONLY_PROVIDER_PLUGIN_IDS: "ollama",
|
||||
VITEST: "",
|
||||
NODE_ENV: "development",
|
||||
|
||||
@@ -14,6 +14,24 @@ const MISTRAL_PLUGIN_CONFIG = {
|
||||
},
|
||||
} as OpenClawConfig;
|
||||
|
||||
function createProviderRuntimeSmokeContext(): {
|
||||
config: OpenClawConfig;
|
||||
env: NodeJS.ProcessEnv;
|
||||
workspaceDir: string;
|
||||
} {
|
||||
const env = { ...process.env };
|
||||
delete env.OPENCLAW_BUNDLED_PLUGINS_DIR;
|
||||
delete env.OPENCLAW_SKIP_PROVIDERS;
|
||||
delete env.OPENCLAW_SKIP_CHANNELS;
|
||||
delete env.OPENCLAW_SKIP_CRON;
|
||||
delete env.OPENCLAW_TEST_MINIMAL_GATEWAY;
|
||||
return {
|
||||
config: {},
|
||||
env,
|
||||
workspaceDir: process.cwd(),
|
||||
};
|
||||
}
|
||||
|
||||
beforeEach(async () => {
|
||||
vi.resetModules();
|
||||
vi.doUnmock("../plugins/provider-runtime.js");
|
||||
@@ -25,6 +43,7 @@ beforeEach(async () => {
|
||||
describe("resolveTranscriptPolicy e2e smoke", () => {
|
||||
it("uses images-only sanitization without tool-call id rewriting for OpenAI models", () => {
|
||||
const policy = resolveTranscriptPolicy({
|
||||
...createProviderRuntimeSmokeContext(),
|
||||
provider: "openai",
|
||||
modelId: "gpt-4o",
|
||||
modelApi: "openai",
|
||||
@@ -36,6 +55,7 @@ describe("resolveTranscriptPolicy e2e smoke", () => {
|
||||
|
||||
it("uses strict9 tool-call sanitization for Mistral-family models", () => {
|
||||
const policy = resolveTranscriptPolicy({
|
||||
...createProviderRuntimeSmokeContext(),
|
||||
provider: "mistral",
|
||||
modelId: "mistral-large-latest",
|
||||
config: MISTRAL_PLUGIN_CONFIG,
|
||||
|
||||
Reference in New Issue
Block a user