Files
OmniRoute/tests/unit/validation-search-embedding-split.test.ts
Diego Rodrigues de Sa e Souza 537e5b5f6e refactor(api): extrai validators search + embedding/rerank de validation.ts (#4932)
Integrated into release/v3.8.36
2026-06-24 11:48:10 -03:00

34 lines
1.7 KiB
TypeScript

// Characterization of the validation.ts search + embedding split (god-file decomposition): the
// web-search validators (+ SEARCH_VALIDATOR_CONFIGS) moved into validation/searchProviders.ts and the
// embedding/rerank/clarifai validators into validation/embeddingProviders.ts. Behavior-preserving
// move — the lock is module surface; runtime behavior stays covered by the search-provider-validation
// and provider-validation-specialty suites.
import { test } from "node:test";
import assert from "node:assert/strict";
const search = await import("../../src/lib/providers/validation/searchProviders.ts");
const embed = await import("../../src/lib/providers/validation/embeddingProviders.ts");
const HOST = await import("../../src/lib/providers/validation.ts");
test("searchProviders exposes the search validators + the per-provider config map", () => {
assert.equal(typeof (search as Record<string, unknown>).validateSearchProvider, "function");
assert.equal(typeof (search as Record<string, unknown>).validateGenericProvider, "function");
const cfg = (search as Record<string, Record<string, unknown>>).SEARCH_VALIDATOR_CONFIGS;
assert.ok(cfg && typeof cfg === "object");
assert.ok(Object.keys(cfg).length > 0, "SEARCH_VALIDATOR_CONFIGS must carry the provider configs");
});
test("embeddingProviders exposes clarifai + embedding + rerank validators", () => {
for (const name of [
"validateClarifaiProvider",
"validateEmbeddingApiProvider",
"validateRerankApiProvider",
]) {
assert.equal(typeof (embed as Record<string, unknown>)[name], "function", `missing ${name}`);
}
});
test("host dispatcher surface stays intact after the move", () => {
assert.equal(typeof (HOST as Record<string, unknown>).validateProviderApiKey, "function");
});