mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 07:10:43 +00:00
test: tighten cli status helper assertions
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
@@ -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}`);
|
||||
|
||||
@@ -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}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user