mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-24 15:21:12 +00:00
* feat(linux): add node device capabilities * fix(linux-node): actionable pending-approval error + node-host advertise integration test * fix(linux-node): map geoclue access-denied to LOCATION_DISABLED; floor camera maxWidth to avoid zero-height scale * fix(linux-node): clamp small camera maxWidth to 2 instead of default * docs(linux-node): clarify where-am-i -t is a process timeout, not update throttle * refactor(gateway): extract legacy-node filter + rejection hint to fit LOC ratchet; docs-map + deadcode baseline * fix(gateway): drop now-unused DEFAULT_DANGEROUS_NODE_COMMANDS import after hint extraction * test(node-host): drop imports orphaned by removed error-code test
42 lines
1.3 KiB
TypeScript
42 lines
1.3 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { createLinuxNodePluginConfigSchema, resolveLinuxNodePluginConfig } from "./config.js";
|
|
|
|
describe("linux-node config", () => {
|
|
it("uses surprise-safe capability defaults", () => {
|
|
expect(resolveLinuxNodePluginConfig(undefined)).toEqual({
|
|
notify: { enabled: true },
|
|
camera: { enabled: false },
|
|
location: { enabled: false },
|
|
});
|
|
});
|
|
|
|
it("accepts explicit capability gates and rejects unknown keys", () => {
|
|
expect(
|
|
resolveLinuxNodePluginConfig({
|
|
notify: { enabled: false },
|
|
camera: { enabled: true },
|
|
location: { enabled: true },
|
|
}),
|
|
).toEqual({
|
|
notify: { enabled: false },
|
|
camera: { enabled: true },
|
|
location: { enabled: true },
|
|
});
|
|
expect(() => resolveLinuxNodePluginConfig({ camera: { enabled: true, extra: true } })).toThrow(
|
|
"Invalid linux-node plugin config",
|
|
);
|
|
});
|
|
|
|
it("exports the same strict shape through the plugin schema", () => {
|
|
const safeParse = createLinuxNodePluginConfigSchema().safeParse;
|
|
if (!safeParse) {
|
|
throw new Error("missing config schema validator");
|
|
}
|
|
const result = safeParse({
|
|
camera: { enabled: true },
|
|
unexpected: true,
|
|
});
|
|
expect(result.success).toBe(false);
|
|
});
|
|
});
|