mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-18 05:57:29 +00:00
perf(test): fold tui command parsing into tui suite
This commit is contained in:
@@ -1,21 +0,0 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { getSlashCommands, parseCommand } from "./commands.js";
|
||||
|
||||
describe("tui slash commands", () => {
|
||||
it("treats /elev as an alias for /elevated", () => {
|
||||
expect(parseCommand("/elev on")).toEqual({ name: "elevated", args: "on" });
|
||||
});
|
||||
|
||||
it("normalizes alias case", () => {
|
||||
expect(parseCommand("/ELEV off")).toEqual({
|
||||
name: "elevated",
|
||||
args: "off",
|
||||
});
|
||||
});
|
||||
|
||||
it("includes gateway text commands", () => {
|
||||
const commands = getSlashCommands({});
|
||||
expect(commands.some((command) => command.name === "context")).toBe(true);
|
||||
expect(commands.some((command) => command.name === "commands")).toBe(true);
|
||||
});
|
||||
});
|
||||
@@ -1,4 +1,5 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { getSlashCommands, parseCommand } from "./commands.js";
|
||||
import { resolveFinalAssistantText, resolveTuiSessionKey } from "./tui.js";
|
||||
|
||||
describe("resolveFinalAssistantText", () => {
|
||||
@@ -16,6 +17,25 @@ describe("resolveFinalAssistantText", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("tui slash commands", () => {
|
||||
it("treats /elev as an alias for /elevated", () => {
|
||||
expect(parseCommand("/elev on")).toEqual({ name: "elevated", args: "on" });
|
||||
});
|
||||
|
||||
it("normalizes alias case", () => {
|
||||
expect(parseCommand("/ELEV off")).toEqual({
|
||||
name: "elevated",
|
||||
args: "off",
|
||||
});
|
||||
});
|
||||
|
||||
it("includes gateway text commands", () => {
|
||||
const commands = getSlashCommands({});
|
||||
expect(commands.some((command) => command.name === "context")).toBe(true);
|
||||
expect(commands.some((command) => command.name === "commands")).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("resolveTuiSessionKey", () => {
|
||||
it("uses global only as the default when scope is global", () => {
|
||||
expect(
|
||||
|
||||
Reference in New Issue
Block a user