Add read-only MG4 ADB status collector

This commit is contained in:
2026-07-31 19:17:43 +02:00
parent 4970fda1b5
commit 3e3e0010d6
16 changed files with 411 additions and 20 deletions
+24
View File
@@ -0,0 +1,24 @@
import { describe, expect, it } from "vitest";
import { loadConfig } from "../src/config.js";
describe("ADB configuration", () => {
it("is disabled by default", () => {
expect(loadConfig({ NODE_ENV: "test" }).adb).toEqual({
enabled: false,
executable: "adb",
serial: null,
timeoutMs: 3_000
});
});
it("requires a constrained serial when enabled", () => {
expect(() => loadConfig({ NODE_ENV: "test", ADB_ENABLED: "true" })).toThrow("ADB_SERIAL is required");
expect(() =>
loadConfig({ NODE_ENV: "test", ADB_ENABLED: "true", ADB_SERIAL: "serial; shell command" })
).toThrow();
expect(loadConfig({ NODE_ENV: "test", ADB_ENABLED: "true", ADB_SERIAL: "10.0.0.10:5555" }).adb).toMatchObject({
enabled: true,
serial: "10.0.0.10:5555"
});
});
});