mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-15 15:40:45 +00:00
test: tighten backup asset assertions
This commit is contained in:
@@ -88,12 +88,19 @@ describe("backup commands", () => {
|
||||
plan: Awaited<ReturnType<typeof resolveBackupPlanFromDisk>>,
|
||||
) {
|
||||
expect(plan.included).toHaveLength(1);
|
||||
expect(plan.included[0]?.kind).toBe("state");
|
||||
const [included] = plan.included;
|
||||
expect(included).toMatchObject({ kind: "state" });
|
||||
expect(plan.skipped).toEqual(
|
||||
expect.arrayContaining([expect.objectContaining({ kind: "workspace", reason: "covered" })]),
|
||||
);
|
||||
}
|
||||
|
||||
function expectOnlyAssetKind(assets: Array<{ kind: string }>, kind: string) {
|
||||
expect(assets).toHaveLength(1);
|
||||
const [asset] = assets;
|
||||
expect(asset).toMatchObject({ kind });
|
||||
}
|
||||
|
||||
it("collapses default config, credentials, and workspace into the state backup root", async () => {
|
||||
const stateDir = path.join(tempHome.home, ".openclaw");
|
||||
const configPath = path.join(stateDir, "openclaw.json");
|
||||
@@ -394,8 +401,7 @@ describe("backup commands", () => {
|
||||
dryRun: true,
|
||||
onlyConfig: true,
|
||||
});
|
||||
expect(configOnly.assets).toHaveLength(1);
|
||||
expect(configOnly.assets[0]?.kind).toBe("config");
|
||||
expectOnlyAssetKind(configOnly.assets, "config");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -428,7 +434,6 @@ describe("backup commands", () => {
|
||||
|
||||
expect(result.onlyConfig).toBe(true);
|
||||
expect(result.includeWorkspace).toBe(false);
|
||||
expect(result.assets).toHaveLength(1);
|
||||
expect(result.assets[0]?.kind).toBe("config");
|
||||
expectOnlyAssetKind(result.assets, "config");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user