test(model-fallback): google provider 모델명 변환 테스트 추가

google provider에서 gemini-3-pro → gemini-3-pro-preview 변환이
getNextFallback를 통해 정상 적용되는지 검증하는 테스트 추가.
기존 github-copilot 테스트와 동일한 패턴으로 작성.
This commit is contained in:
east-shine
2026-02-25 21:40:28 +09:00
parent f6d5f6f79f
commit 94ff673d40

View File

@@ -11,6 +11,7 @@ describe("model fallback hook", () => {
beforeEach(() => {
clearPendingModelFallback("ses_model_fallback_main")
clearPendingModelFallback("ses_model_fallback_ghcp")
clearPendingModelFallback("ses_model_fallback_google")
})
test("applies pending fallback on chat.message by overriding model", async () => {
@@ -184,4 +185,48 @@ describe("model fallback hook", () => {
clearPendingModelFallback(sessionID)
})
test("transforms model names for google provider via fallback chain", async () => {
//#given
const sessionID = "ses_model_fallback_google"
clearPendingModelFallback(sessionID)
const hook = createModelFallbackHook() as unknown as {
"chat.message"?: (
input: { sessionID: string },
output: { message: Record<string, unknown>; parts: Array<{ type: string; text?: string }> },
) => Promise<void>
}
// Set a custom fallback chain that routes through google
setSessionFallbackChain(sessionID, [
{ providers: ["google"], model: "gemini-3-pro" },
])
const set = setPendingModelFallback(
sessionID,
"Oracle",
"google",
"gemini-3-pro",
)
expect(set).toBe(true)
const output = {
message: {
model: { providerID: "google", modelID: "gemini-3-pro" },
},
parts: [{ type: "text", text: "continue" }],
}
//#when
await hook["chat.message"]?.({ sessionID }, output)
//#then — model name should be transformed from gemini-3-pro to gemini-3-pro-preview
expect(output.message["model"]).toEqual({
providerID: "google",
modelID: "gemini-3-pro-preview",
})
clearPendingModelFallback(sessionID)
})
})