Add read-only MG4 ADB status collector
This commit is contained in:
@@ -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"
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user