92ec2550d2
- Moved test files from src/core to test/core directory. - Moved test files from src/core/tools to test/tools directory. - Moved test files from src/discovery to test/discovery directory. - Updated import paths to reflect new test file locations.
44 lines
1.3 KiB
TypeScript
44 lines
1.3 KiB
TypeScript
import { describe, expect, it } from "bun:test";
|
|
import { createTools, type ToolSession } from "../../src/core/tools/index";
|
|
|
|
function createSession(overrides: Partial<ToolSession> = {}): ToolSession {
|
|
return {
|
|
cwd: "/tmp/test",
|
|
hasUI: false,
|
|
getSessionFile: () => null,
|
|
getSessionSpawns: () => "*",
|
|
settings: {
|
|
getImageAutoResize: () => true,
|
|
getLspFormatOnWrite: () => true,
|
|
getLspDiagnosticsOnWrite: () => true,
|
|
getLspDiagnosticsOnEdit: () => false,
|
|
getEditFuzzyMatch: () => true,
|
|
getGitToolEnabled: () => true,
|
|
getBashInterceptorEnabled: () => true,
|
|
getBashInterceptorSimpleLsEnabled: () => true,
|
|
getBashInterceptorRules: () => [],
|
|
getPythonToolMode: () => "bash-only",
|
|
getPythonKernelMode: () => "session",
|
|
},
|
|
...overrides,
|
|
};
|
|
}
|
|
|
|
describe("createTools python fallback", () => {
|
|
it("falls back to bash when python is requested but disabled", async () => {
|
|
const previous = process.env.OMP_PYTHON_SKIP_CHECK;
|
|
process.env.OMP_PYTHON_SKIP_CHECK = "1";
|
|
const session = createSession();
|
|
const tools = await createTools(session, ["python"]);
|
|
const names = tools.map((tool) => tool.name);
|
|
|
|
expect(names).toEqual(["bash"]);
|
|
|
|
if (previous === undefined) {
|
|
delete process.env.OMP_PYTHON_SKIP_CHECK;
|
|
} else {
|
|
process.env.OMP_PYTHON_SKIP_CHECK = previous;
|
|
}
|
|
});
|
|
});
|