Files
OmniRoute/tests/unit/copilot-codegraph-knowledge.test.ts
Jan Leon 74c006e245 Add reasoning-based model and effort routing (#7607)
* feat(routing): add reasoning-based model and effort routing

* refactor(routing): modularize reasoning and auto-routing pipeline

* fix(routing): remove redundant DB re-export and prevent SQL scan false positives

* fix(routing): resolve reasoning routing review blockers

* fix(i18n): keep release ranking fallbacks outside reasoning

* fix(db): renumber reasoning-routing migration past release tip (124→125)

124_generic_session_affinity_ttl.sql (#7274) has since landed on
release/v3.8.49 at version 124, colliding with this PR's own
124_reasoning_routing_rules.sql. Renumbers to 125 (the next free slot
past the current release tip) and updates the one filename reference
in docs/routing/REASONING_ROUTING.md.

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>

* chore(db): renumber reasoning-routing migration 125→126 (slot taken by #7360)

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>

* refactor(api): compact temp-path decls in exportAll GET (complexity-ratchet lines budget)

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>

* refactor(api): single-statement auth guard in exportAll GET (function under 80-line cap)

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>

---------

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
2026-07-18 22:09:47 -03:00

41 lines
962 B
TypeScript

import test from "node:test";
import assert from "node:assert/strict";
import {
findCallers,
getCodeGraphStats,
isCodeGraphAvailable,
searchSymbols,
setCodeGraphPathForTest,
} from "../../src/lib/copilot/codegraphKnowledge.ts";
test("CodeGraph knowledge helpers fail closed when the index is unavailable", () => {
setCodeGraphPathForTest(null);
try {
assert.equal(isCodeGraphAvailable(), false);
assert.deepEqual(searchSymbols("handleChatCore"), {
success: false,
data: null,
error: "CodeGraph DB not found",
engine: "none",
});
assert.deepEqual(findCallers("handleChatCore"), {
success: false,
data: null,
error: "CodeGraph DB not found",
engine: "none",
});
assert.deepEqual(getCodeGraphStats(), {
success: false,
data: null,
error: "CodeGraph DB not found",
engine: "none",
});
} finally {
setCodeGraphPathForTest(undefined);
}
});