Files
OmniRoute/tests/unit/batch-page-static.test.ts
Praveen K Palaniswamy 65e81158ab fix(ollama): route models by advertised capability (#11088)
Landed with the design call resolved per the owner's pick — **option 1**: the synced store is now endpoint-agnostic (persistDiscoveredModels and managedModelImport no longer drop non-chat models at write time), and chat selectability moved to read time (auto-pool expansion in autoStrategy applies filterChatSelectableModels; the models-route projection already had its chatOnly filter). Your discovery test now passes end-to-end (3/3): /api/show capabilities persist per connection and image/embedding requests route through the advertising host.

Reconciliation notes: conflicted areas merged onto the current tip (adobe discovery import, requestedModel preflight signature, resolvedProvider fast-path coexists with the synced-route override — explicit resolution wins); carried base-red drains (#10055 memoization, #11071 test variants) dropped as already-landed; the managed-model-import exclusion test was propagated to the new contract (image/video models persist; the read filter still hides them from chat pickers — pinned by a new assertion). Full battery: 205/206 focused (the one red is a confirmed periodic-timer timing flake on the loaded devbox — 20/20 isolated), autoCombo vitest 30/30, combo suites 46/46, gates + typecheck clean.

Thank you @yourspraveen — the capability probe + routing design was right; it just needed the store contract opened up. Fixes #11087.
2026-08-23 11:45:01 -03:00

74 lines
2.2 KiB
TypeScript

import test from "node:test";
import assert from "node:assert/strict";
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
const pagePath = path.join(
repoRoot,
"src/app/(dashboard)/dashboard/batch/page.tsx"
);
const enPath = path.join(repoRoot, "src/i18n/messages/en.json");
function readBatchPage() {
return fs.readFileSync(pagePath, "utf8");
}
function readEnKeys() {
return Object.keys(JSON.parse(fs.readFileSync(enPath, "utf8")));
}
test("batch page stable header uses t() for subtitle", () => {
const source = readBatchPage();
assert.match(source, /batchHeaderSubtitle/);
});
test("batch page stable header uses t() for three-step strip", () => {
const source = readBatchPage();
assert.match(source, /batchStep1/);
assert.match(source, /batchStep2/);
assert.match(source, /batchStep3/);
assert.match(source, /batchStep1Desc/);
assert.match(source, /batchStep2Desc/);
assert.match(source, /batchStep3Desc/);
});
test("batch page stable header keeps Create batch CTA using t()", () => {
const source = readBatchPage();
assert.match(source, /batchListNewButton/);
});
test("batch page still renders collapsible BatchConceptCard as optional deeper explanation", () => {
const source = readBatchPage();
assert.match(source, /BatchConceptCard/);
});
test("batch page stable header does not contain hardcoded English", () => {
const source = readBatchPage();
assert.doesNotMatch(source, /Run many requests as one job/);
assert.doesNotMatch(source, /1 \· Upload JSONL/);
assert.doesNotMatch(source, /2 \· Create batch/);
assert.doesNotMatch(source, /3 \· Get results/);
});
test("new i18n keys exist in en.json common namespace", () => {
const enKeys = JSON.parse(
fs.readFileSync(
path.join(repoRoot, "src/i18n/messages/en.json"),
"utf8"
)
).common || {};
const requiredKeys = [
"batchHeaderSubtitle",
"batchStep1",
"batchStep2",
"batchStep3",
"batchStep1Desc",
"batchStep2Desc",
"batchStep3Desc",
];
for (const key of requiredKeys) {
assert.ok(key in enKeys, `Missing i18n key in en.json common namespace: ${key}`);
}
});