mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-12 09:41:11 +00:00
test: keep plugin runtime symlink assertion on symlink path
This commit is contained in:
@@ -394,13 +394,13 @@ describe("stageBundledPluginRuntime", () => {
|
||||
createDistPluginDir(repoRoot, "feishu");
|
||||
setupRepoFiles(repoRoot, {
|
||||
[bundledDistPluginFile("feishu", "index.js")]: "export default {}\n",
|
||||
[bundledDistPluginFile("feishu", "skills/feishu-doc/SKILL.md")]: "# Feishu Doc\n",
|
||||
[bundledDistPluginFile("feishu", "skills/feishu-doc/fixture.txt")]: "# Feishu Doc\n",
|
||||
});
|
||||
|
||||
const realSymlinkSync = fs.symlinkSync.bind(fs);
|
||||
const symlinkSpy = vi.spyOn(fs, "symlinkSync").mockImplementation(((target, link, type) => {
|
||||
const linkPath = String(link);
|
||||
if (linkPath.endsWith(path.join("skills", "feishu-doc", "SKILL.md"))) {
|
||||
if (linkPath.endsWith(path.join("skills", "feishu-doc", "fixture.txt"))) {
|
||||
const err = Object.assign(new Error("file already exists"), { code: "EEXIST" });
|
||||
realSymlinkSync(String(target), linkPath, type);
|
||||
throw err;
|
||||
@@ -417,7 +417,7 @@ describe("stageBundledPluginRuntime", () => {
|
||||
"feishu",
|
||||
"skills",
|
||||
"feishu-doc",
|
||||
"SKILL.md",
|
||||
"fixture.txt",
|
||||
);
|
||||
expect(fs.lstatSync(runtimeSkillPath).isSymbolicLink()).toBe(true);
|
||||
expect(fs.readFileSync(runtimeSkillPath, "utf8")).toBe("# Feishu Doc\n");
|
||||
|
||||
Reference in New Issue
Block a user