test: tighten cli status helper assertions

This commit is contained in:
Peter Steinberger
2026-05-08 20:47:32 +01:00
parent 189a074573
commit 3a2cd7ded5
3 changed files with 4 additions and 7 deletions

View File

@@ -43,7 +43,6 @@ describe("plugins cli policy mutations", () => {
function requireFirstWrittenConfig(): OpenClawConfig {
const [config] = writeConfigFile.mock.calls[0] ?? [];
expect(config).toBeDefined();
if (!config) {
throw new Error("expected writeConfigFile to receive a config");
}
@@ -53,7 +52,6 @@ describe("plugins cli policy mutations", () => {
function requirePluginEntries(
config: OpenClawConfig,
): NonNullable<NonNullable<OpenClawConfig["plugins"]>["entries"]> {
expect(config.plugins?.entries).toBeDefined();
if (!config.plugins?.entries) {
throw new Error("expected plugin entries in config");
}

View File

@@ -303,12 +303,12 @@ describe("agentCliCommand", () => {
expect(callGateway).toHaveBeenCalledTimes(1);
expect(agentCommand).toHaveBeenCalledTimes(1);
const fallbackOpts = requireFirstCallArg<{
const fallbackOpts = requireFirstCallArg(agentCommand, "embedded agent") as {
sessionId?: string;
sessionKey?: string;
runId?: string;
resultMetaOverrides?: unknown;
}>(agentCommand, "embedded agent");
};
expect(fallbackOpts.sessionId).toMatch(/^gateway-fallback-/);
expect(fallbackOpts.sessionId).not.toBe("locked-session");
expect(fallbackOpts.sessionKey).toBe(`agent:main:explicit:${fallbackOpts.sessionId}`);
@@ -342,11 +342,11 @@ describe("agentCliCommand", () => {
runtime,
);
const fallbackOpts = requireFirstCallArg<{
const fallbackOpts = requireFirstCallArg(agentCommand, "embedded agent") as {
sessionId?: string;
sessionKey?: string;
to?: string;
}>(agentCommand, "embedded agent");
};
expect(fallbackOpts.to).toBe("+1555");
expect(fallbackOpts.sessionId).toMatch(/^gateway-fallback-/);
expect(fallbackOpts.sessionKey).toBe(`agent:main:explicit:${fallbackOpts.sessionId}`);

View File

@@ -87,7 +87,6 @@ function getRuntimeLogs() {
function getRuntimeLog(index: number): string {
const call = runtimeLogMock.mock.calls[index];
expect(call).toBeDefined();
if (!call) {
throw new Error(`expected runtime log call ${index}`);
}