mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-18 22:14:47 +00:00
test: tighten backup create assertions
This commit is contained in:
@@ -391,22 +391,17 @@ describe("createBackupArchive", () => {
|
||||
const entries = await listArchiveEntries(result.archivePath);
|
||||
|
||||
const entrySuffixes = entries.map((entry) => entry.replace(/^.*\/state\//, "/state/"));
|
||||
expect(entrySuffixes).toEqual(
|
||||
expect.arrayContaining([
|
||||
"/state/extensions/demo/openclaw.plugin.json",
|
||||
"/state/extensions/demo/src/index.js",
|
||||
"/state/node_modules/root-dep/index.js",
|
||||
]),
|
||||
);
|
||||
expect(entrySuffixes).toContain("/state/extensions/demo/openclaw.plugin.json");
|
||||
expect(entrySuffixes).toContain("/state/extensions/demo/src/index.js");
|
||||
expect(entrySuffixes).toContain("/state/node_modules/root-dep/index.js");
|
||||
const pluginNodeModuleEntries = entries.filter((entry) =>
|
||||
entry.includes("/state/extensions/demo/node_modules/"),
|
||||
);
|
||||
expect(pluginNodeModuleEntries).toStrictEqual([]);
|
||||
|
||||
const runtime: RuntimeEnv = { log: vi.fn(), error: vi.fn(), exit: vi.fn() };
|
||||
await expect(
|
||||
backupVerifyCommand(runtime, { archive: result.archivePath }),
|
||||
).resolves.toMatchObject({ ok: true });
|
||||
const verification = await backupVerifyCommand(runtime, { archive: result.archivePath });
|
||||
expect(verification.ok).toBe(true);
|
||||
},
|
||||
);
|
||||
});
|
||||
@@ -439,9 +434,8 @@ describe("createBackupArchive", () => {
|
||||
expect(rootManifestEntries).toHaveLength(1);
|
||||
|
||||
const runtime: RuntimeEnv = { log: vi.fn(), error: vi.fn(), exit: vi.fn() };
|
||||
await expect(
|
||||
backupVerifyCommand(runtime, { archive: result.archivePath }),
|
||||
).resolves.toMatchObject({ ok: true });
|
||||
const verification = await backupVerifyCommand(runtime, { archive: result.archivePath });
|
||||
expect(verification.ok).toBe(true);
|
||||
} finally {
|
||||
tmpdirSpy.mockRestore();
|
||||
}
|
||||
@@ -474,9 +468,8 @@ describe("createBackupArchive", () => {
|
||||
expect(rootManifestEntries).toHaveLength(1);
|
||||
|
||||
const runtime: RuntimeEnv = { log: vi.fn(), error: vi.fn(), exit: vi.fn() };
|
||||
await expect(
|
||||
backupVerifyCommand(runtime, { archive: result.archivePath }),
|
||||
).resolves.toMatchObject({ ok: true });
|
||||
const verification = await backupVerifyCommand(runtime, { archive: result.archivePath });
|
||||
expect(verification.ok).toBe(true);
|
||||
} finally {
|
||||
tmpdirSpy.mockRestore();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user