mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 14:40:43 +00:00
test(plugins): align persisted registry snapshot assertion
This commit is contained in:
@@ -96,7 +96,7 @@ describe("loadPluginRegistrySnapshotWithMetadata", () => {
|
|||||||
expect(result.diagnostics).toEqual([]);
|
expect(result.diagnostics).toEqual([]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("keeps persisted package plugins on the fast path when file signatures match", () => {
|
it("keeps persisted package plugins when file hashes match", () => {
|
||||||
const tempRoot = makeTempDir();
|
const tempRoot = makeTempDir();
|
||||||
const rootDir = path.join(tempRoot, "workspace");
|
const rootDir = path.join(tempRoot, "workspace");
|
||||||
const stateDir = path.join(tempRoot, "state");
|
const stateDir = path.join(tempRoot, "state");
|
||||||
@@ -113,19 +113,14 @@ describe("loadPluginRegistrySnapshotWithMetadata", () => {
|
|||||||
expect(record?.packageJson?.fileSignature).toBeDefined();
|
expect(record?.packageJson?.fileSignature).toBeDefined();
|
||||||
writePersistedInstalledPluginIndexSync(index, { stateDir });
|
writePersistedInstalledPluginIndexSync(index, { stateDir });
|
||||||
|
|
||||||
const readFileSyncSpy = vi.spyOn(fs, "readFileSync");
|
|
||||||
const result = loadPluginRegistrySnapshotWithMetadata({
|
const result = loadPluginRegistrySnapshotWithMetadata({
|
||||||
config,
|
config,
|
||||||
env,
|
env,
|
||||||
stateDir,
|
stateDir,
|
||||||
});
|
});
|
||||||
const pluginManifestFileReads = readFileSyncSpy.mock.calls.filter((call) => {
|
|
||||||
const filePath = String(call[0]);
|
|
||||||
return filePath === path.join(rootDir, "openclaw.plugin.json");
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(result.source).toBe("persisted");
|
expect(result.source).toBe("persisted");
|
||||||
expect(pluginManifestFileReads).toEqual([]);
|
expect(result.diagnostics).toEqual([]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("detects same-size same-mtime manifest replacements", () => {
|
it("detects same-size same-mtime manifest replacements", () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user