Files
openclaw/src/plugins/runtime-degraded-state.test.ts
T
Peter Steinberger eecbfcc960 fix(infra): unify env-truthiness, missing-path, realpath, and abort-sleep semantics (#120359)
* fix(infra): unify environment truthiness

* fix(infra): unify missing path classification

* refactor(infra): unify realpath fallbacks

* fix(infra): unify abortable sleep errors

* docs(infra): clarify path fallback semantics

* fix(infra): route realpaths through policy wrapper

* fix(infra): ratchet plugin SDK wildcard budget

* fix(agents): preserve zero-delay abort precedence

* fix(infra): preserve fallback and media recovery contracts

* fix(plugins): share quarantine path resolution
2026-08-08 10:58:57 -07:00

35 lines
1.3 KiB
TypeScript

import fs from "node:fs";
import path from "node:path";
import { describe, expect, it } from "vitest";
import { withTempDirSync } from "../test-helpers/temp-dir.js";
import { pluginInstallPathMatchesRoot } from "./runtime-degraded-state.js";
describe("pluginInstallPathMatchesRoot", () => {
it("matches an existing plugin root through a symlink alias", () => {
if (process.platform === "win32") {
return;
}
withTempDirSync({ prefix: "openclaw-degraded-plugin-root-" }, (baseDir) => {
const pluginRoot = path.join(baseDir, "plugin");
const pluginAlias = path.join(baseDir, "plugin-alias");
fs.mkdirSync(pluginRoot);
fs.symlinkSync(pluginRoot, pluginAlias, "dir");
expect(pluginInstallPathMatchesRoot(pluginAlias, pluginRoot)).toBe(true);
});
});
it("falls back to absolute lexical paths when plugin roots are missing", () => {
withTempDirSync({ prefix: "openclaw-degraded-plugin-root-" }, (baseDir) => {
const missingRoot = path.join(baseDir, "missing-plugin");
const equivalentMissingRoot = path.join(baseDir, "nested", "..", "missing-plugin");
expect(pluginInstallPathMatchesRoot(equivalentMissingRoot, missingRoot)).toBe(true);
expect(pluginInstallPathMatchesRoot(path.join(baseDir, "other-missing"), missingRoot)).toBe(
false,
);
});
});
});