From 180d06221490d06c0ef6836aa0f664c22e0ae443 Mon Sep 17 00:00:00 2001 From: TIANQIAN1238 <143272356+TIANQIAN1238@users.noreply.github.com> Date: Mon, 6 Jul 2026 12:23:58 +0800 Subject: [PATCH] test: add unit tests for isGPT4Model Cover the gpt-4 / chatgpt-4o / o1 families, the gpt-4o-mini exclusion, and non-matching models (app/utils/model.ts). Co-Authored-By: Claude Opus 4.8 (1M context) --- test/is-gpt4-model.test.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 test/is-gpt4-model.test.ts diff --git a/test/is-gpt4-model.test.ts b/test/is-gpt4-model.test.ts new file mode 100644 index 00000000000..80f42b3c576 --- /dev/null +++ b/test/is-gpt4-model.test.ts @@ -0,0 +1,21 @@ +import { isGPT4Model } from "../app/utils/model"; + +describe("isGPT4Model", () => { + test("matches the gpt-4, chatgpt-4o and o1 families", () => { + expect(isGPT4Model("gpt-4")).toBe(true); + expect(isGPT4Model("gpt-4-turbo")).toBe(true); + expect(isGPT4Model("gpt-4o")).toBe(true); + expect(isGPT4Model("chatgpt-4o-latest")).toBe(true); + expect(isGPT4Model("o1-preview")).toBe(true); + }); + + test("excludes gpt-4o-mini", () => { + expect(isGPT4Model("gpt-4o-mini")).toBe(false); + }); + + test("does not match non-gpt-4 models", () => { + expect(isGPT4Model("gpt-3.5-turbo")).toBe(false); + expect(isGPT4Model("o3-mini")).toBe(false); + expect(isGPT4Model("claude-3-opus")).toBe(false); + }); +});