From 54f6feb2d74b9ac81fa5f826f24f73929c7cb238 Mon Sep 17 00:00:00 2001 From: code-october <148516338+code-october@users.noreply.github.com> Date: Sat, 30 Nov 2024 07:28:38 +0000 Subject: [PATCH] update unit test --- test/model-available.test.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test/model-available.test.ts b/test/model-available.test.ts index 09a7143e2f4..2d222e05259 100644 --- a/test/model-available.test.ts +++ b/test/model-available.test.ts @@ -9,14 +9,24 @@ describe("isModelNotavailableInServer", () => { expect(result).toBe(false); }); - test("test model will return false, which means the model is not available", () => { + test("test model will return true when model is not available in custom models", () => { const customModels = "-all,gpt-4o-mini"; const modelName = "gpt-4"; const providerNames = "OpenAI"; const result = isModelNotavailableInServer(customModels, modelName, providerNames); expect(result).toBe(true); }); + test("should respect DISABLE_GPT4 setting", () => { + process.env.DISABLE_GPT4 = "1"; + const result = isModelNotavailableInServer("", "gpt-4", "OpenAI"); + expect(result).toBe(true); + }); + test("should handle empty provider names", () => { + const result = isModelNotavailableInServer("-all,gpt-4", "gpt-4", ""); + expect(result).toBe(true); + }); + test("support passing multiple providers, model unavailable on one of the providers will return true", () => { const customModels = "-all,gpt-4@Google"; const modelName = "gpt-4";