mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 08:11:38 +00:00
test(auto-reply): type set/unset action helper expectations
This commit is contained in:
@@ -1,6 +1,11 @@
|
|||||||
import { describe, expect, it } from "vitest";
|
import { describe, expect, it } from "vitest";
|
||||||
import { parseSetUnsetCommand, parseSetUnsetCommandAction } from "./commands-setunset.js";
|
import { parseSetUnsetCommand, parseSetUnsetCommandAction } from "./commands-setunset.js";
|
||||||
|
|
||||||
|
type ParsedSetUnsetAction =
|
||||||
|
| { action: "set"; path: string; value: unknown }
|
||||||
|
| { action: "unset"; path: string }
|
||||||
|
| { action: "error"; message: string };
|
||||||
|
|
||||||
describe("parseSetUnsetCommand", () => {
|
describe("parseSetUnsetCommand", () => {
|
||||||
it("parses unset values", () => {
|
it("parses unset values", () => {
|
||||||
expect(
|
expect(
|
||||||
@@ -25,7 +30,7 @@ describe("parseSetUnsetCommand", () => {
|
|||||||
|
|
||||||
describe("parseSetUnsetCommandAction", () => {
|
describe("parseSetUnsetCommandAction", () => {
|
||||||
it("returns null for non set/unset actions", () => {
|
it("returns null for non set/unset actions", () => {
|
||||||
const result = parseSetUnsetCommandAction({
|
const result = parseSetUnsetCommandAction<ParsedSetUnsetAction>({
|
||||||
slash: "/config",
|
slash: "/config",
|
||||||
action: "show",
|
action: "show",
|
||||||
args: "",
|
args: "",
|
||||||
@@ -37,7 +42,7 @@ describe("parseSetUnsetCommandAction", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("maps parse errors through onError", () => {
|
it("maps parse errors through onError", () => {
|
||||||
const result = parseSetUnsetCommandAction({
|
const result = parseSetUnsetCommandAction<ParsedSetUnsetAction>({
|
||||||
slash: "/config",
|
slash: "/config",
|
||||||
action: "set",
|
action: "set",
|
||||||
args: "",
|
args: "",
|
||||||
|
|||||||
Reference in New Issue
Block a user