mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-09 00:01:17 +00:00
test(providers): cover opencode replay family hooks
This commit is contained in:
48
extensions/opencode-go/index.test.ts
Normal file
48
extensions/opencode-go/index.test.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { registerSingleProviderPlugin } from "../../test/helpers/plugins/plugin-registration.js";
|
||||
import plugin from "./index.js";
|
||||
|
||||
describe("opencode-go provider plugin", () => {
|
||||
it("owns passthrough-gemini replay policy for Gemini-backed models", async () => {
|
||||
const provider = await registerSingleProviderPlugin(plugin);
|
||||
|
||||
expect(
|
||||
provider.buildReplayPolicy?.({
|
||||
provider: "opencode-go",
|
||||
modelApi: "openai-completions",
|
||||
modelId: "gemini-2.5-pro",
|
||||
} as never),
|
||||
).toMatchObject({
|
||||
applyAssistantFirstOrderingFix: false,
|
||||
validateGeminiTurns: false,
|
||||
validateAnthropicTurns: false,
|
||||
sanitizeThoughtSignatures: {
|
||||
allowBase64Only: true,
|
||||
includeCamelCase: true,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps non-Gemini replay policy minimal on passthrough routes", async () => {
|
||||
const provider = await registerSingleProviderPlugin(plugin);
|
||||
|
||||
expect(
|
||||
provider.buildReplayPolicy?.({
|
||||
provider: "opencode-go",
|
||||
modelApi: "openai-completions",
|
||||
modelId: "qwen3-coder",
|
||||
} as never),
|
||||
).toMatchObject({
|
||||
applyAssistantFirstOrderingFix: false,
|
||||
validateGeminiTurns: false,
|
||||
validateAnthropicTurns: false,
|
||||
});
|
||||
expect(
|
||||
provider.buildReplayPolicy?.({
|
||||
provider: "opencode-go",
|
||||
modelApi: "openai-completions",
|
||||
modelId: "qwen3-coder",
|
||||
} as never),
|
||||
).not.toHaveProperty("sanitizeThoughtSignatures");
|
||||
});
|
||||
});
|
||||
48
extensions/opencode/index.test.ts
Normal file
48
extensions/opencode/index.test.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { registerSingleProviderPlugin } from "../../test/helpers/plugins/plugin-registration.js";
|
||||
import plugin from "./index.js";
|
||||
|
||||
describe("opencode provider plugin", () => {
|
||||
it("owns passthrough-gemini replay policy for Gemini-backed models", async () => {
|
||||
const provider = await registerSingleProviderPlugin(plugin);
|
||||
|
||||
expect(
|
||||
provider.buildReplayPolicy?.({
|
||||
provider: "opencode",
|
||||
modelApi: "openai-completions",
|
||||
modelId: "gemini-2.5-pro",
|
||||
} as never),
|
||||
).toMatchObject({
|
||||
applyAssistantFirstOrderingFix: false,
|
||||
validateGeminiTurns: false,
|
||||
validateAnthropicTurns: false,
|
||||
sanitizeThoughtSignatures: {
|
||||
allowBase64Only: true,
|
||||
includeCamelCase: true,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps non-Gemini replay policy minimal on passthrough routes", async () => {
|
||||
const provider = await registerSingleProviderPlugin(plugin);
|
||||
|
||||
expect(
|
||||
provider.buildReplayPolicy?.({
|
||||
provider: "opencode",
|
||||
modelApi: "openai-completions",
|
||||
modelId: "claude-opus-4.6",
|
||||
} as never),
|
||||
).toMatchObject({
|
||||
applyAssistantFirstOrderingFix: false,
|
||||
validateGeminiTurns: false,
|
||||
validateAnthropicTurns: false,
|
||||
});
|
||||
expect(
|
||||
provider.buildReplayPolicy?.({
|
||||
provider: "opencode",
|
||||
modelApi: "openai-completions",
|
||||
modelId: "claude-opus-4.6",
|
||||
} as never),
|
||||
).not.toHaveProperty("sanitizeThoughtSignatures");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user