From 94ff673d40483eeea192bd843d385ae23f670391 Mon Sep 17 00:00:00 2001 From: east-shine Date: Wed, 25 Feb 2026 21:40:28 +0900 Subject: [PATCH] =?UTF-8?q?test(model-fallback):=20google=20provider=20?= =?UTF-8?q?=EB=AA=A8=EB=8D=B8=EB=AA=85=20=EB=B3=80=ED=99=98=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit google provider에서 gemini-3-pro → gemini-3-pro-preview 변환이 getNextFallback를 통해 정상 적용되는지 검증하는 테스트 추가. 기존 github-copilot 테스트와 동일한 패턴으로 작성. --- src/hooks/model-fallback/hook.test.ts | 45 +++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/src/hooks/model-fallback/hook.test.ts b/src/hooks/model-fallback/hook.test.ts index 3d3b4e749..348f163a1 100644 --- a/src/hooks/model-fallback/hook.test.ts +++ b/src/hooks/model-fallback/hook.test.ts @@ -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; parts: Array<{ type: string; text?: string }> }, + ) => Promise + } + + // 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) + }) })