test(ollama): add authMode regression test
This commit is contained in:
parent
352dd17e76
commit
dbe6f9d292
1 changed files with 20 additions and 0 deletions
20
src/resources/extensions/ollama/ollama-auth-mode.test.ts
Normal file
20
src/resources/extensions/ollama/ollama-auth-mode.test.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/**
|
||||
* Regression test for #3440: Ollama extension must register with
|
||||
* authMode "apiKey" (not "none") to avoid streamSimple requirement.
|
||||
*/
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { join, dirname } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
test("Ollama registers with authMode apiKey, not none (#3440)", () => {
|
||||
const src = readFileSync(join(__dirname, "index.ts"), "utf-8");
|
||||
// Find the registerProvider call
|
||||
const registerBlock = src.slice(src.indexOf("pi.registerProvider(\"ollama\""));
|
||||
const authLine = registerBlock.match(/authMode:\s*"(\w+)"/);
|
||||
assert.ok(authLine, "registerProvider must specify authMode");
|
||||
assert.equal(authLine![1], "apiKey", "authMode must be apiKey, not none");
|
||||
});
|
||||
Loading…
Add table
Reference in a new issue