Tests: make plugin ownership mismatch assertion root-safe

This commit is contained in:
Muhammed Mukhthar CM
2026-03-03 05:21:43 +00:00
parent 92aabbfbd2
commit 67f20c6609

View File

@@ -343,9 +343,10 @@ describe("discoverOpenClawPlugins", () => {
const result = await withStateDir(stateDir, async () => {
return discoverOpenClawPlugins({ ownershipUid: actualUid + 1 });
});
expect(result.candidates).toHaveLength(0);
const shouldBlockForMismatch = actualUid !== 0;
expect(result.candidates).toHaveLength(shouldBlockForMismatch ? 0 : 1);
expect(result.diagnostics.some((diag) => diag.message.includes("suspicious ownership"))).toBe(
true,
shouldBlockForMismatch,
);
},
);