diff --git a/src/commands/agents.delete.test.ts b/src/commands/agents.delete.test.ts index 6827c317e8a..57a9c2fe2e3 100644 --- a/src/commands/agents.delete.test.ts +++ b/src/commands/agents.delete.test.ts @@ -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(); diff --git a/src/commands/backup.test.ts b/src/commands/backup.test.ts index 17069b8a796..ed0c43c48b5 100644 --- a/src/commands/backup.test.ts +++ b/src/commands/backup.test.ts @@ -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"); } diff --git a/src/commands/doctor-state-integrity.linux-storage.test.ts b/src/commands/doctor-state-integrity.linux-storage.test.ts index 9d1ea696ce8..6c3789b3b8e 100644 --- a/src/commands/doctor-state-integrity.linux-storage.test.ts +++ b/src/commands/doctor-state-integrity.linux-storage.test.ts @@ -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"); diff --git a/src/commands/doctor/shared/legacy-config-migrate.test.ts b/src/commands/doctor/shared/legacy-config-migrate.test.ts index ba9d3acbee6..985e7558e23 100644 --- a/src/commands/doctor/shared/legacy-config-migrate.test.ts +++ b/src/commands/doctor/shared/legacy-config-migrate.test.ts @@ -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(); }); });