Skip to content

Commit

Permalink
update unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
code-october committed Nov 30, 2024
1 parent e1ac053 commit 54f6feb
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion test/model-available.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit 54f6feb

Please sign in to comment.