mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-18 14:44:45 +00:00
test: require command helper results
This commit is contained in:
@@ -276,8 +276,7 @@ describe("agents delete command", () => {
|
||||
await agentsDeleteCommand({ id: "ops", force: true, json: true }, runtime);
|
||||
|
||||
// Workspace should still exist — it was shared
|
||||
const stat = await fs.stat(sharedWorkspace).catch(() => null);
|
||||
expect(stat).not.toBeNull();
|
||||
await expect(fs.stat(sharedWorkspace)).resolves.toEqual(expect.any(Object));
|
||||
|
||||
// The JSON output should report why the workspace was retained.
|
||||
const jsonOutput = readJsonLogs();
|
||||
|
||||
@@ -210,6 +210,8 @@ describe("backup commands", () => {
|
||||
expect(result.archivePath).toBe(
|
||||
path.join(backupDir, `${buildBackupArchiveRoot(nowMs)}.tar.gz`),
|
||||
);
|
||||
expect(capturedManifest).toEqual(expect.objectContaining({ assets: expect.any(Array) }));
|
||||
expect(capturedOnWriteEntry).toEqual(expect.any(Function));
|
||||
if (capturedManifest === null || capturedOnWriteEntry === null) {
|
||||
throw new Error("Expected backup manifest and archive entry callback");
|
||||
}
|
||||
|
||||
@@ -115,8 +115,11 @@ describe("detectLinuxSdBackedStateDir", () => {
|
||||
},
|
||||
});
|
||||
|
||||
expect(result).not.toBeNull();
|
||||
const warning = formatLinuxSdBackedStateDirWarning(stateDir, result!);
|
||||
expect(result).toEqual(expect.any(Object));
|
||||
if (result === null) {
|
||||
throw new Error("Expected Linux state storage warning details");
|
||||
}
|
||||
const warning = formatLinuxSdBackedStateDirWarning(stateDir, result);
|
||||
expect(warning).toContain("device /dev/disk/by-uuid/mmc\\nsource");
|
||||
expect(warning).toContain("mount /home/pi/mnt\\nspoofed");
|
||||
expect(warning).not.toContain("device /dev/disk/by-uuid/mmc\nsource");
|
||||
|
||||
@@ -656,8 +656,11 @@ describe("legacy migrate heartbeat config", () => {
|
||||
});
|
||||
|
||||
expect(res.changes).toContain("Removed empty top-level heartbeat.");
|
||||
expect(res.config).not.toBeNull();
|
||||
expect((res.config as { heartbeat?: unknown } | null)?.heartbeat).toBeUndefined();
|
||||
expect(res.config).toEqual(expect.any(Object));
|
||||
if (res.config === null) {
|
||||
throw new Error("Expected migrated config");
|
||||
}
|
||||
expect((res.config as { heartbeat?: unknown }).heartbeat).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user