Files
boss/tests/orchestration-backend-selector.test.ts
2026-04-03 02:22:02 +08:00

54 lines
1.5 KiB
TypeScript

import assert from "node:assert/strict";
import test from "node:test";
import {
listOrchestrationBackendChoices,
selectOrchestrationBackendForTesting,
} from "@/lib/execution/orchestration-backend-selector";
test("listOrchestrationBackendChoices keeps omx disabled by default", async () => {
const backends = await listOrchestrationBackendChoices();
assert.deepEqual(
backends.map((backend) => backend.backendId),
["boss-native-orchestrator"],
);
});
test("selectOrchestrationBackendForTesting honors explicit omx request when selectable", async () => {
const backend = await selectOrchestrationBackendForTesting({
requestedBackendId: "omx-team",
omx: {
enabled: true,
selectable: true,
availability: {
status: "ready",
selectable: true,
configured: true,
reason: "ready",
reasonLabel: "OMX Team Runtime 可用。",
},
},
});
assert.equal(backend.backendId, "omx-team");
});
test("selectOrchestrationBackendForTesting falls back when omx is requested but unavailable", async () => {
const backend = await selectOrchestrationBackendForTesting({
requestedBackendId: "omx-team",
omx: {
enabled: false,
selectable: false,
availability: {
status: "disabled",
selectable: false,
configured: false,
reason: "disabled",
reasonLabel: "OMX Team Runtime 当前未启用。",
},
},
});
assert.equal(backend.backendId, "boss-native-orchestrator");
});