test(plugins): align persisted registry snapshot assertion

This commit is contained in:
Vincent Koc
2026-05-02 18:55:27 -07:00
parent a89b0dda2f
commit 3d64fcaf1f

View File

@@ -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", () => {