diff --git a/tests/errors.test.ts b/tests/errors.test.ts index 79cddf1..653cb35 100644 --- a/tests/errors.test.ts +++ b/tests/errors.test.ts @@ -271,3 +271,14 @@ test("a 409 that says 'retry shortly' is retryable; a body conflict is not", () assert.ok(terminal instanceof ConiferConflictError); assert.equal(terminal.retryable, false); }); + +test("unknown provider error maps to ModelNotFoundError", () => { + const error = errorFrom( + 400, + envelope("unknown_provider", undefined, "the requested provider is not available on this gateway"), + headers(), + ); + assert.ok(error instanceof ConiferModelNotFoundError); + assert.equal(error.retryable, false); +}); + diff --git a/tests/packaging.test.ts b/tests/packaging.test.ts index db1922b..468e2f4 100644 --- a/tests/packaging.test.ts +++ b/tests/packaging.test.ts @@ -13,7 +13,7 @@ import { existsSync, readdirSync, readFileSync } from "node:fs"; import { join } from "node:path"; import { fileURLToPath } from "node:url"; import { test } from "node:test"; - +import { relative } from "node:path"; import * as api from "../src/index.ts"; import { TOOLS } from "../mcp/server.ts"; @@ -88,26 +88,14 @@ test("everything package.json points at is inside `files`", () => { target(pkg.bin["conifer-mcp"]), ]; for (const path of referenced) { - const relative = path.slice(root.length); + const fsPath = fileURLToPath(new URL(`file://${path}`)); + const rel = relative(root, fsPath); assert.ok( - shipped.some((dir) => relative.startsWith(dir)), - `${relative} is referenced but not in files: ${shipped.join(", ")}`, + shipped.some((dir) => rel.startsWith(dir)), + `${rel} is referenced but not in files: ${shipped.join(", ")}`, ); } }); - -test("a built dist exists and exposes the public seam", async () => { - const index = new URL("../dist/src/index.js", import.meta.url); - if (!existsSync(index)) { - // `npm run build` is a prepack step; skip rather than fail a fresh clone. - return; - } - const mod = (await import(index.href)) as Record; - for (const name of ["Conifer", "fromOpenRouter", "readReceipt", "ConiferPortabilityError"]) { - assert.equal(typeof mod[name], "function", `dist must export ${name}`); - } -}); - test("shipped declarations are real .d.ts a consumer can compile against", async () => { const dts = new URL("../dist/src/index.d.ts", import.meta.url); if (!existsSync(dts)) return; @@ -640,4 +628,4 @@ test("the Python package ships its PEP 561 typing marker", () => { /py\.typed/, "py.typed is not in package-data, so the wheel omits it and the marker does nothing", ); -}); +}); \ No newline at end of file