import { describe, expect, it } from "vitest"; import {
AGENT_LANE_NESTED,
isNestedAgentLane,
resolveNestedAgentLane,
resolveNestedAgentLaneForSession,
} from "./lanes.js";
describe("resolveNestedAgentLane", () => {
it("defaults to the nested lane when no lane is provided", () => {
expect(resolveNestedAgentLane()).toBe(AGENT_LANE_NESTED);
});
it("moves cron lane callers onto the nested lane", () => {
expect(resolveNestedAgentLane("cron")).toBe(AGENT_LANE_NESTED);
expect(resolveNestedAgentLane(" cron ")).toBe(AGENT_LANE_NESTED);
});
describe("resolveNestedAgentLaneForSession (#67502)", () => {
it("falls back to the unscoped nested lane when no session key is provided", () => {
expect(resolveNestedAgentLaneForSession(undefined)).toBe(AGENT_LANE_NESTED);
expect(resolveNestedAgentLaneForSession("")).toBe(AGENT_LANE_NESTED);
expect(resolveNestedAgentLaneForSession(" ")).toBe(AGENT_LANE_NESTED);
});
it("scopes the nested lane per target session key", () => {
expect(resolveNestedAgentLaneForSession("agent:ebao-next:discord:channel:1")).toBe(
`${AGENT_LANE_NESTED}:agent:ebao-next:discord:channel:1`,
);
});
it("is deterministic for the same session key across calls", () => { const key = "agent:ebao:discord:channel:1";
expect(resolveNestedAgentLaneForSession(key)).toBe(resolveNestedAgentLaneForSession(key));
});
it("trims whitespace around the session key before scoping", () => {
expect(resolveNestedAgentLaneForSession(" agent:ebao:main ")).toBe(
`${AGENT_LANE_NESTED}:agent:ebao:main`,
);
});
});
describe("isNestedAgentLane", () => {
it("returns true for the unscoped nested lane", () => {
expect(isNestedAgentLane(AGENT_LANE_NESTED)).toBe(true);
});
it("returns false for lanes that merely contain 'nested' as a substring", () => {
expect(isNestedAgentLane("deeply-nested-lane")).toBe(false);
expect(isNestedAgentLane("session:nested")).toBe(false);
expect(isNestedAgentLane("nestedfoo")).toBe(false);
});
it("returns false for empty or missing lane names", () => {
expect(isNestedAgentLane(undefined)).toBe(false);
expect(isNestedAgentLane("")).toBe(false);
});
});
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.20 Sekunden
(vorverarbeitet am 2026-05-26)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.